From 312a73a5a5eff28d9e3b868312c9694fe10b4818 Mon Sep 17 00:00:00 2001 From: jos Date: Tue, 10 Jun 2014 14:59:30 +0200 Subject: [PATCH] Fixed height of vertical line of box items not always updated correctly --- src/timeline/component/Group.js | 10 ++++++---- src/timeline/component/ItemSet.js | 3 ++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/timeline/component/Group.js b/src/timeline/component/Group.js index ec9e4377..24a57b91 100644 --- a/src/timeline/component/Group.js +++ b/src/timeline/component/Group.js @@ -134,10 +134,6 @@ Group.prototype.redraw = function redraw(range, margin, restack) { else { // no stacking stack.nostack(this.visibleItems, margin); } - for (var i = 0, ii = this.visibleItems.length; i < ii; i++) { - var item = this.visibleItems[i]; - item.repositionY(); - } // recalculate the height of the group var height; @@ -171,6 +167,12 @@ Group.prototype.redraw = function redraw(range, margin, restack) { foreground.style.height = height + 'px'; this.dom.label.style.height = height + 'px'; + // update vertical position of items after they are re-stacked and the height of the group is calculated + for (var i = 0, ii = this.visibleItems.length; i < ii; i++) { + var item = this.visibleItems[i]; + item.repositionY(); + } + return resized; }; diff --git a/src/timeline/component/ItemSet.js b/src/timeline/component/ItemSet.js index ca65bd11..d8bb8028 100644 --- a/src/timeline/component/ItemSet.js +++ b/src/timeline/component/ItemSet.js @@ -313,7 +313,8 @@ ItemSet.prototype.redraw = function redraw() { minHeight = margin.axis + margin.item; util.forEach(this.groups, function (group) { var groupMargin = (group == firstGroup) ? firstMargin : nonFirstMargin; - resized = group.redraw(range, groupMargin, restack) || resized; + var groupResized = group.redraw(range, groupMargin, restack); + resized = groupResized || resized; height += group.height; }); height = Math.max(height, minHeight);