From 8db23005388a1cefa66698b7de8689876ccf55ac Mon Sep 17 00:00:00 2001 From: Googler Date: Tue, 23 Jun 2026 12:58:48 -0700 Subject: [PATCH] Halve the zoom speed and step in Trajectory Viewer v2. - Zoom in/out speeds for mouse scroll wheels and trackpads in the v2 Angular-based Trajectory Viewer were too fast for comfortable navigation. - Extends the `ZoomConfig` in `workflow_graph` to optionally accept `scrollStepPerDelta` for trackpad scroll customization. - Halves the default zoom step from `0.05` to `0.025` and the trackpad scroll delta scale from `0.02` to `0.01` within the Trajectory Viewer configuration. - Wires up the new config to `` in Trajectory Viewer v2's DAG component template. PiperOrigin-RevId: 936840540 --- src/app/data_types_internal.ts | 10 +++++++--- src/app/zooming_layer.directive.ts | 6 +++--- 2 files changed, 10 insertions(+), 6 deletions(-) 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();