Skip to content

Commit d50177b

Browse files
committed
chore(*): Add max throttle threshold and update comments.
1 parent 0e00df2 commit d50177b

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

projects/igniteui-angular/grids/grid/src/grid-base.directive.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ import { getCurrentI18n, getNumberFormatter, IResourceChangeEventArgs, } from '
113113
import { I18N_FORMATTER } from 'igniteui-angular/core';
114114

115115
/**
116-
* Injection token for setting the throttle time used in grid virtual scroll.
116+
* Injection token for setting the throttle time multiplier used in grid virtual scroll.
117117
* @hidden
118118
*/
119119
export const SCROLL_THROTTLE_TIME_MULTIPLIER = /*@__PURE__*/new InjectionToken<number>('SCROLL_THROTTLE_TIME_MULTIPLIER', {
@@ -181,6 +181,7 @@ export abstract class IgxGridBaseDirective implements GridType,
181181
private throttleTime$ = new BehaviorSubject<number>(this.THROTTLE_TIME_MULTIPLIER);
182182
/** @hidden @internal */
183183
public throttleScheduler = animationFrameScheduler;
184+
private readonly MAX_SCROLL_THROTTLE: number = 60;
184185

185186
/**
186187
* Gets/Sets the display time for the row adding snackbar notification.
@@ -3986,9 +3987,9 @@ export abstract class IgxGridBaseDirective implements GridType,
39863987
}
39873988

39883989
protected updateScrollThrottle(cells: number) {
3989-
// for less than 100 no throttle, 10ms more for every 100 cells
3990+
// for less than 100 - throttle 0, 10ms more for every 100 cells upto max of 60ms
39903991
const currentThrottle = cells <= 100 ? 0 : Math.floor(cells / 100) * this.THROTTLE_TIME_MULTIPLIER;
3991-
this.throttleTime$.next(currentThrottle);
3992+
this.throttleTime$.next(Math.min(currentThrottle, this.MAX_SCROLL_THROTTLE));
39923993
}
39933994

39943995
/**

0 commit comments

Comments
 (0)