diff --git a/src/app/data_types_internal.ts b/src/app/data_types_internal.ts index 18db32d..33fb235 100644 --- a/src/app/data_types_internal.ts +++ b/src/app/data_types_internal.ts @@ -390,17 +390,21 @@ export interface ZoomConfig { max: number; /** Buttons should increment or decrement by what magnitude. Default: .05 */ step: number; + /** Increment or decrement per scroll / trackpad delta. Default: .02 */ + scrollStepPerDelta?: number; } + +/** Increment or decrement per scroll / trackpad delta. */ +export const SCROLL_STEP_PER_DELTA = .02; + /** Default zoom config that can be used for DAG Toolbar or DAG Renderer */ export const defaultZoomConfig: ZoomConfig = { max: 1.5, min: .2, step: .10, + scrollStepPerDelta: SCROLL_STEP_PER_DELTA, }; -/** Increment or decrement per scroll / trackpad delta. */ -export const SCROLL_STEP_PER_DELTA = .02; - /** * Allows you to construct a full DAG Zoom Config set from partial entries * which override the defaults diff --git a/src/app/zooming_layer.directive.ts b/src/app/zooming_layer.directive.ts index dba6eed..cfcbebf 100644 --- a/src/app/zooming_layer.directive.ts +++ b/src/app/zooming_layer.directive.ts @@ -144,13 +144,13 @@ export class ZoomingLayer implements OnInit, OnDestroy { } private zoomOnWheel($e: WheelEvent) { - const {min, max} = this.zoomStepConfig; + const {min, max, step, scrollStepPerDelta = SCROLL_STEP_PER_DELTA} = this.zoomStepConfig; const invSign = $e.deltaY > 0 ? -1 : 1; let newZoom = this.stateService.zoom.value + invSign * Math.min( - SCROLL_STEP_PER_DELTA * Math.abs($e.deltaY), - this.zoomStepConfig.step); + scrollStepPerDelta * Math.abs($e.deltaY), + step); newZoom = clampVal(newZoom, min, max); const container = this.dagWrapper.nativeElement.getBoundingClientRect();