Skip to content

Commit

Permalink
Consider append delay for Grid.render onComplete
Browse files Browse the repository at this point in the history
  • Loading branch information
joelfillmore committed Jun 12, 2014
1 parent 0829b01 commit 2b5c53f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Grid.js
Expand Up @@ -300,6 +300,7 @@
heightPlusPadding = this.cellHeight + this.cellPadding,
tileIndex = 0,
appendDelay = 0,
maxAppendDelay = 0,
viewRect = new Tiles.Rectangle(
this.$el.scrollLeft(),
this.$el.scrollTop(),
Expand Down Expand Up @@ -351,6 +352,7 @@
appendDelay = this.getAppendDelay(
cellRect, pageRects, priorityRects,
tile, pageTiles, priorityTiles);
maxAppendDelay = Math.max(maxAppendDelay, appendDelay) || 0;
} else {
appendDelay = 0;
}
Expand All @@ -373,7 +375,10 @@
this.isDirty = false;

if (onComplete) {
setTimeout(function() { onComplete(true); }, duration + 10);
setTimeout(
function() { onComplete(true); },
Math.max(maxAppendDelay, duration) + 10
);
}
};

Expand Down

0 comments on commit 2b5c53f

Please sign in to comment.