Skip to content

Commit

Permalink
fix(virtual-repeat): sync scroll margin with scroll animation
Browse files Browse the repository at this point in the history
  • Loading branch information
martingust committed Dec 14, 2015
1 parent d921554 commit e9a27a6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/virtual-repeat.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,15 +186,15 @@ export class VirtualRepeat {
this.previousY = this.currentY;
first = this.first = Math.ceil(this.currentY / itemHeight) * -1;

if(this._isScrollingDown(first, this.previousFirst, items)){
if((first - this.previousFirst) > 1){
if (this._isScrollingDown(first, this.previousFirst, items)){
if ((first - this.previousFirst) > 1) {
first = this.first = this.previousFirst + 1;
this.currentY = this.currentY + itemHeight;
}
this.previousFirst = first;
this._rebindAndMoveToBottom();
}else if (this._isScrollingUp(first, this.previousFirst)){
if((this.previousFirst - first) > 1){
} else if (this._isScrollingUp(first, this.previousFirst)){
if ((this.previousFirst - first) > 1) {
first = this.first = this.previousFirst - 1;
this.currentY = this.currentY - itemHeight;
}
Expand Down Expand Up @@ -338,7 +338,7 @@ export class VirtualRepeat {
view.bindingContext[this.local] = items[index];
viewSlot.children.push(viewSlot.children.shift());
this.domStrategy.moveViewLast(view, virtualScrollInner, childrenLength);
let marginTop = this.itemHeight * first + "px";
let marginTop = -this.currentY + "px";
virtualScrollInner.style.marginTop = marginTop;
}

Expand All @@ -354,7 +354,7 @@ export class VirtualRepeat {
updateOverrideContext(view.overrideContext, first, items.length);
viewSlot.children.unshift(viewSlot.children.splice(-1,1)[0]);
this.domStrategy.moveViewFirst(view, virtualScrollInner);
let marginTop = this.itemHeight * first + "px";
let marginTop = -this.currentY + "px";
virtualScrollInner.style.marginTop = marginTop;
}
}
Expand Down

0 comments on commit e9a27a6

Please sign in to comment.