var originalUpdateLayout = NodeListView.prototype.updateLayout; NodeListView.prototype.updateLayout = function () { var prevSize = new Size(0, 0); for (var i = 0, l = this.items.length; i < l; i++) { var size = this.iconSize != null ? this.iconSize : this.items[i].getBounds().getSize(); this.items[i].removeCanvasElements(); this.removeElement(this.boxes[i]); this.removeElement(this.items[i].text); var b = Rect.fromPositionAndSize( this.listCoords(this.padding + (this.len(prevSize) + i * this.padding * 2), (this.brth(this.bounds) - this.brth(size)) / 2), size); this.items[i].setBounds(b); var itemSize = new Size(prevSize.width + size.width, prevSize.height + size.height); var captionSize = this.measureString(this.captions[i].text, this.captionFont); captionSize.height += this.padding; captionSize.width += this.padding; var c = Rect.fromPositionAndSize( this.listCoords(this.padding + (this.len(itemSize) + i * this.padding * 2 + this.padding), this.brth(this.bounds) / 2 - this.brth(captionSize) / 2), captionSize); this.captions[i].setBounds(c); var boxSize = new Size(c.width + size.width, c.height + size.height); var b = Rect.fromPositionAndSize( this.listCoords( (this.len(prevSize) + i * this.padding * 2), 0), this.listSize( this.len(boxSize) + this.padding * 2, this.brth(this.bounds))); this.boxes[i].x = b.x; this.boxes[i].y = b.y; this.boxes[i].width = b.width; this.boxes[i].height = b.height; this.items[i].addCanvasElements(); this.addElement(this.boxes[i]); this.addElement(this.items[i].text); prevSize.width += boxSize.width; prevSize.height += boxSize.height; } this.updateCanvasSize(); if (this.updateLayoutId) { clearTimeout(this.updateLayoutId); this.updateLayoutId = null; } };