Skip to content

Commit

Permalink
Prevent items from being repeatedly redrawn while off screen
Browse files Browse the repository at this point in the history
Fixes almende#3249 again, because my previous PR got overwritten
  • Loading branch information
Joshua Walsh committed Oct 30, 2017
1 parent cdff6b1 commit 55272b1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions lib/timeline/component/Group.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,9 +282,9 @@ Group.prototype._redrawItems = function(forceRestack, lastIsVisible, margin, ran
var redrawQueueLength = 0;

util.forEach(this.items, function (item, key) {
if (!item.displayed) {
if (!item.displayed && (item.isVisible(range) || !item.dom)) {
var returnQueue = true;
redrawQueue[key] = item.redraw(returnQueue);
redrawQueue[key] = item.show(true);
redrawQueueLength = redrawQueue[key].length;
me.visibleItems.push(item);
}
Expand All @@ -301,7 +301,9 @@ Group.prototype._redrawItems = function(forceRestack, lastIsVisible, margin, ran
}

util.forEach(this.items, function (item) {
item.repositionX(limitSize);
if(item.displayed) {
item.repositionX(limitSize);
}
});

if (this.doInnerStack && this.itemSet.options.stackSubgroups) {
Expand Down
4 changes: 2 additions & 2 deletions lib/timeline/component/item/RangeItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ RangeItem.prototype.redraw = function(returnQueue) {
* Show the item in the DOM (when not already visible). The items DOM will
* be created when needed.
*/
RangeItem.prototype.show = function() {
RangeItem.prototype.show = function(returnQueue) {
if (!this.displayed) {
this.redraw();
return this.redraw(returnQueue);
}
};

Expand Down

0 comments on commit 55272b1

Please sign in to comment.