Skip to content

Commit

Permalink
mousewheel_handle on wheel and not mousewheel (non standard event) + …
Browse files Browse the repository at this point in the history
…programmable mouse zoom key,

(cherry picked from commit 59577a3)
  • Loading branch information
sam committed Sep 12, 2024
1 parent 635d521 commit 0da13a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/jsmind.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export default class jsMind {
this.view.add_event(this, 'mousedown', this.mousedown_handle);
this.view.add_event(this, 'click', this.click_handle);
this.view.add_event(this, 'dblclick', this.dblclick_handle);
this.view.add_event(this, 'mousewheel', this.mousewheel_handle, true);
this.view.add_event(this, 'wheel', this.mousewheel_handle, true);
}
mousedown_handle(e) {
if (!this.options.default_event_handle['enable_mousedown_handle']) {
Expand Down Expand Up @@ -172,7 +172,7 @@ export default class jsMind {
// Use [Ctrl] + Mousewheel, to zoom in/out.
mousewheel_handle(e) {
// Test if mousewheel option is enabled and Ctrl key is pressed.
if (!this.options.default_event_handle['enable_mousewheel_handle'] || !e.ctrlKey) {
if (!this.options.default_event_handle['enable_mousewheel_handle'] || (this.options.view.zoom.ctrlKey && !e.ctrlKey) || (this.options.view.zoom.shiftKey && !e.shiftKey) || (this.options.view.zoom.altKey && !e.altKey) || (this.options.view.zoom.metaKey && !e.metaKey)) {
return;
}
var evt = e || event;
Expand Down
4 changes: 4 additions & 0 deletions src/jsmind.option.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ const default_options = {
min: 0.5,
max: 2.1,
step: 0.1,
ctrlKey:true,
shiftKey:true,
altKey:false,
metaKey:false,
},
custom_node_render: null,
expander_style: 'char', // [char | number]
Expand Down

0 comments on commit 0da13a7

Please sign in to comment.