Skip to content

Commit

Permalink
feat: accessor for mousewheel
Browse files Browse the repository at this point in the history
should check status before update enable status, avoid bind event again and again

re #16 #41
  • Loading branch information
bubkoo committed Dec 19, 2019
1 parent 42abf49 commit 4537463
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions packages/x6/src/graph/mousewheel-accessor.ts
Expand Up @@ -5,13 +5,26 @@ export class MouseWheelAccessor extends BaseGraph {
return this.mouseWheelHandler.isEnabled()
}

setMouseWheelEnabled(enabled: boolean) {
if (enabled) {
this.enableMouseWheel()
} else {
this.disableMouseWheel()
}
return this
}

enableMouseWheel() {
this.mouseWheelHandler.enable()
if (!this.isMouseWheelEnabled()) {
this.mouseWheelHandler.enable()
}
return this
}

disableMouseWheel() {
this.mouseWheelHandler.disable()
if (this.isMouseWheelEnabled()) {
this.mouseWheelHandler.disable()
}
return this
}

Expand Down

0 comments on commit 4537463

Please sign in to comment.