From 177df89a41f6a7e5dfcfb543542a245c0c6328e5 Mon Sep 17 00:00:00 2001 From: itigoore01 Date: Thu, 3 Oct 2019 22:29:14 +0900 Subject: [PATCH] feat(praparat): will-change debounce time can be set from config --- projects/praparat/src/lib/praparat-config.ts | 5 ++++- projects/praparat/src/lib/praparat.component.ts | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/projects/praparat/src/lib/praparat-config.ts b/projects/praparat/src/lib/praparat-config.ts index 369b460..e2d1d82 100644 --- a/projects/praparat/src/lib/praparat-config.ts +++ b/projects/praparat/src/lib/praparat-config.ts @@ -7,6 +7,7 @@ export interface PraparatConfig { wheelZoomFactor: number; maxScale: number; minScale: number; + willChangeDebounceTime: number; } export function createPrapratConfig(config: Partial = {}): PraparatConfig { @@ -15,7 +16,8 @@ export function createPrapratConfig(config: Partial = {}): Prapa initialPan = { x: 0, y: 0 }, wheelZoomFactor = 0.01, maxScale = 100, - minScale = 0.01 + minScale = 0.01, + willChangeDebounceTime = 300, } = config; return { @@ -24,6 +26,7 @@ export function createPrapratConfig(config: Partial = {}): Prapa wheelZoomFactor, maxScale, minScale, + willChangeDebounceTime, }; } diff --git a/projects/praparat/src/lib/praparat.component.ts b/projects/praparat/src/lib/praparat.component.ts index dc1520a..93beabd 100644 --- a/projects/praparat/src/lib/praparat.component.ts +++ b/projects/praparat/src/lib/praparat.component.ts @@ -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) {