Skip to content
This repository has been archived by the owner on Mar 31, 2023. It is now read-only.

Commit

Permalink
feat(praparat): will-change debounce time can be set from config
Browse files Browse the repository at this point in the history
  • Loading branch information
itigoore01 committed Oct 3, 2019
1 parent f4105e9 commit 177df89
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion projects/praparat/src/lib/praparat-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export interface PraparatConfig {
wheelZoomFactor: number;
maxScale: number;
minScale: number;
willChangeDebounceTime: number;
}

export function createPrapratConfig(config: Partial<PraparatConfig> = {}): PraparatConfig {
Expand All @@ -15,7 +16,8 @@ export function createPrapratConfig(config: Partial<PraparatConfig> = {}): Prapa
initialPan = { x: 0, y: 0 },
wheelZoomFactor = 0.01,
maxScale = 100,
minScale = 0.01
minScale = 0.01,
willChangeDebounceTime = 300,
} = config;

return {
Expand All @@ -24,6 +26,7 @@ export function createPrapratConfig(config: Partial<PraparatConfig> = {}): Prapa
wheelZoomFactor,
maxScale,
minScale,
willChangeDebounceTime,
};
}

Expand Down
2 changes: 1 addition & 1 deletion projects/praparat/src/lib/praparat.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export class PraparatComponent implements OnDestroy, AfterViewInit {
});

panZoomObservable$.pipe(
debounceTime(300),
debounceTime(this.defaultConfig.willChangeDebounceTime),
takeUntil(this.destroyed),
).subscribe(() => {
if (this.animating.value) {
Expand Down

0 comments on commit 177df89

Please sign in to comment.