Skip to content

Commit

Permalink
fix: paning mousewheel
Browse files Browse the repository at this point in the history
  • Loading branch information
yinhangfeng committed Nov 14, 2023
1 parent 540e3c2 commit 14ddecc
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions packages/x6/src/graph/panning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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) {
Expand Down

0 comments on commit 14ddecc

Please sign in to comment.