From 14ddecca969200b8fc006f643d69ab3ebb401224 Mon Sep 17 00:00:00 2001 From: yinhangfeng Date: Tue, 14 Nov 2023 14:52:29 +0800 Subject: [PATCH] fix: paning mousewheel --- packages/x6/src/graph/panning.ts | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/x6/src/graph/panning.ts b/packages/x6/src/graph/panning.ts index 26e67fb9945..fc70f5903f2 100644 --- a/packages/x6/src/graph/panning.ts +++ b/packages/x6/src/graph/panning.ts @@ -126,13 +126,7 @@ export class PanningManager extends Base { } protected onMouseWheel(e: WheelEvent, deltaX: number, deltaY: number) { - const eventTypes = this.widgetOptions.eventTypes - if (!eventTypes?.includes('mouseWheel')) { - return - } - if (!e.ctrlKey) { - this.graph.translateBy(-deltaX, -deltaY) - } + this.graph.translateBy(-deltaX, -deltaY) } protected allowBlankMouseDown(e: Dom.MouseDownEvent) { @@ -144,7 +138,11 @@ export class PanningManager extends Base { } protected allowMouseWheel(e: WheelEvent) { - return this.pannable && !e.ctrlKey + return ( + this.pannable && + !e.ctrlKey && + this.widgetOptions.eventTypes?.includes('mouseWheel') + ) } autoPanning(x: number, y: number) {