Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/cdk-experimental/scrolling/virtual-scroll-viewport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import {
} from '@angular/core';
import {Observable} from 'rxjs/Observable';
import {fromEvent} from 'rxjs/observable/fromEvent';
import {sampleTime} from 'rxjs/operators/sampleTime';
import {takeUntil} from 'rxjs/operators/takeUntil';
import {throttleTime} from 'rxjs/operators/throttleTime';
import {animationFrame} from 'rxjs/scheduler/animationFrame';
import {Subject} from 'rxjs/Subject';
import {CdkVirtualForOf} from './virtual-for-of';
Expand Down Expand Up @@ -177,7 +177,9 @@ export class CdkVirtualScrollViewport implements OnInit, OnDestroy {

this._ngZone.runOutsideAngular(() => {
fromEvent(this.elementRef.nativeElement, 'scroll')
.pipe(throttleTime(0, animationFrame))
// Sample the scroll stream at every animation frame. This way if there are multiple
// scroll events in the same frame we only need to recheck our layout once
.pipe(sampleTime(0, animationFrame))
.subscribe(() => this._scrollStrategy.onContentScrolled());
});
});
Expand Down
3 changes: 3 additions & 0 deletions tools/package-tools/rollup-globals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ export const rollupGlobals = {
'rxjs/observable/of': 'Rx.Observable',
'rxjs/observable/throw': 'Rx.Observable',

'rxjs/scheduler/animationFrame': 'Rx.Scheduler',

'rxjs/operators/auditTime': 'Rx.operators',
'rxjs/operators/catchError': 'Rx.operators',
'rxjs/operators/combineLatest': 'Rx.operators',
Expand All @@ -81,6 +83,7 @@ export const rollupGlobals = {
'rxjs/operators/first': 'Rx.operators',
'rxjs/operators/map': 'Rx.operators',
'rxjs/operators/pairwise': 'Rx.operators',
'rxjs/operators/sampleTime': 'Rx.operators',
'rxjs/operators/share': 'Rx.operators',
'rxjs/operators/shareReplay': 'Rx.operators',
'rxjs/operators/startWith': 'Rx.operators',
Expand Down