diff --git a/.gitignore b/.gitignore index 8d4ae253..8e33d2c9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ bower_components +node_modules +*.d.ts diff --git a/iron-list.html b/iron-list.html index dc286496..2888b29d 100644 --- a/iron-list.html +++ b/iron-list.html @@ -846,8 +846,11 @@ var idxAdjustment = Math.round(delta / this._physicalAverage) * this._itemsPerRow; this._virtualStart = this._virtualStart + idxAdjustment; this._physicalStart = this._physicalStart + idxAdjustment; - // Estimate new physical offset. - this._physicalTop = Math.floor(this._virtualStart / this._itemsPerRow) * this._physicalAverage; + // Estimate new physical offset based on the virtual start (but never allow + // to be more than the current scrollTop) + this._physicalTop = Math.min( + Math.floor(this._virtualStart / this._itemsPerRow) * + this._physicalAverage, this._scrollPosition); this._update(); } else { var reusables = this._getReusables(isScrollingDown); @@ -882,7 +885,8 @@ var physicalCount = this._physicalCount; var top = this._physicalTop + this._scrollOffset; var bottom = this._physicalBottom + this._scrollOffset; - var scrollTop = this._scrollTop; + // This may be called outside of a scrollHandler, so use last cached position + var scrollTop = this._scrollPosition; var scrollBottom = this._scrollBottom; if (fromTop) { @@ -1412,7 +1416,8 @@ // Note: the delta can be positive or negative. if (deltaHeight !== 0) { this._physicalTop = this._physicalTop - deltaHeight; - var scrollTop = this._scrollTop; + // This may be called outside of a scrollHandler, so use last cached position + var scrollTop = this._scrollPosition; // juking scroll position during interial scrolling on iOS is no bueno if (!IOS_TOUCH_SCROLLING && scrollTop > 0) { this._resetScrollPosition(scrollTop - deltaHeight); diff --git a/test/basic.html b/test/basic.html index 854bcfc0..b21e7968 100644 --- a/test/basic.html +++ b/test/basic.html @@ -19,6 +19,7 @@ +
@@ -28,6 +29,12 @@ +