Skip to content

Commit

Permalink
feat(virtual-repeat): support multiple virtual-repeat after each other
Browse files Browse the repository at this point in the history
  • Loading branch information
martingust committed Mar 19, 2016
1 parent 05ecd2f commit 5e99c07
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/virtual-repeat.js
Expand Up @@ -190,7 +190,7 @@ export class VirtualRepeat {
return;
}
let itemHeight = this.itemHeight;
let scrollTop = this._fixedHeightContainer ? this.topBuffer.scrollTop : pageYOffset - this.scrollContainer.offsetTop;
let scrollTop = this._fixedHeightContainer ? this.topBuffer.scrollTop : pageYOffset - this.topBuffer.offsetTop;
this._first = Math.floor(scrollTop / itemHeight);
this._first = this._first < 0 ? 0 : this._first;
this._checkScrolling();
Expand All @@ -212,7 +212,7 @@ export class VirtualRepeat {
this._adjustBufferHeights();
}
// move view up?
} else if (this._scrollingUp && (this._hasScrolledUpTheBuffer() || (this._switchedDirection && this._hasScrolledUpTheBufferFromBottom()))) {
} else if (this._scrollingUp && (this._hasScrolledUpTheBuffer() || (this._switchedDirection && this._hasScrolledUpTheBufferFromBottom()))) {
let viewsToMove = this._lastRebind - this._first;
if(this._switchedDirection) {
if(this.isLastIndex) {
Expand Down Expand Up @@ -352,8 +352,7 @@ export class VirtualRepeat {
if(this.itemHeight <= 0) {
throw new Error('Could not calculate item height');
}
this.scrollContainerHeight = this._fixedHeightContainer ? this._calcScrollHeight(this.scrollContainer) : document.documentElement.clientHeight - this.topBuffer.offsetTop;

this.scrollContainerHeight = this._fixedHeightContainer ? this._calcScrollHeight(this.scrollContainer) : document.documentElement.clientHeight;
this.elementsInView = Math.ceil(this.scrollContainerHeight / this.itemHeight) + 1;
this._viewsLength = (this.elementsInView * 2) + this._bufferSize;
this._bottomBufferHeight = this.itemHeight * this.items.length - this.itemHeight * this._viewsLength;
Expand Down

0 comments on commit 5e99c07

Please sign in to comment.