From 6e6da98f2120e4e2dc8ac2618a412e1b6c8326d0 Mon Sep 17 00:00:00 2001 From: josdejong Date: Wed, 5 Mar 2014 13:50:08 +0100 Subject: [PATCH] A fix in updating the visible items --- src/timeline/component/ItemSet.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/timeline/component/ItemSet.js b/src/timeline/component/ItemSet.js index c8028004..d7fa4d02 100644 --- a/src/timeline/component/ItemSet.js +++ b/src/timeline/component/ItemSet.js @@ -299,7 +299,7 @@ ItemSet.prototype.repaint = function repaint() { } // find start of visible items - var start = this.visibleItemsStart; + var start = Math.min(this.visibleItemsStart, Math.max(this.orderedItems.length - 1, 0)); var item = this.orderedItems[start]; while (item && item.isVisible() && start > 0) { start--; @@ -314,7 +314,7 @@ ItemSet.prototype.repaint = function repaint() { this.visibleItemsStart = start; // find end of visible items - var end = Math.max(this.visibleItemsStart, this.visibleItemsEnd); + var end = Math.max(Math.min(this.visibleItemsEnd, this.orderedItems.length), this.visibleItemsStart); item = this.orderedItems[end]; while (item && item.isVisible()) { end++;