Skip to content

Commit

Permalink
fixes #74
Browse files Browse the repository at this point in the history
  • Loading branch information
a139383 committed Aug 9, 2017
1 parent d8f4fc7 commit c4b2da5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/virtual-scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export interface ChangeEvent {
exportAs: 'virtualScroll',
template: `
<div class="total-padding" [style.height]="scrollHeight + 'px'"></div>
<div class="scrollable-content" #content [style.transform]="'translateY(' + topPadding + 'px)'">
<div class="scrollable-content" #content [style.transform]="'translateY(' + topPadding + 'px)'"
[style.webkitTransform]="'translateY(' + topPadding + 'px)'">
<ng-content></ng-content>
</div>
`,
Expand Down Expand Up @@ -122,7 +123,7 @@ export class VirtualScrollComponent implements OnInit, OnChanges {

let d = this.calculateDimensions();
this.element.nativeElement.scrollTop = (Math.floor(index / d.itemsPerRow) * d.childHeight)
- (d.childHeight * Math.min(index, this.bufferAmount));
- (d.childHeight * Math.min(index, this.bufferAmount));
this.refresh();
}

Expand Down Expand Up @@ -198,7 +199,7 @@ export class VirtualScrollComponent implements OnInit, OnChanges {
let maxStart = Math.max(0, maxStartEnd - d.itemsPerCol * d.itemsPerRow - d.itemsPerRow);
let start = Math.min(maxStart, Math.floor(indexByScrollTop) * d.itemsPerRow);

this.topPadding = d.childHeight * Math.ceil(start / d.itemsPerRow) - (d.childHeight * Math.min(start, this.bufferAmount));;
this.topPadding = d.childHeight * Math.ceil(start / d.itemsPerRow) - (d.childHeight * Math.min(start, this.bufferAmount)); ;

start = !isNaN(start) ? start : -1;
end = !isNaN(end) ? end : -1;
Expand Down

0 comments on commit c4b2da5

Please sign in to comment.