Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug mousewheel_handle event & programmable mouse zoom key #629

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
Copy link
Owner

@hizzgdev hizzgdev Sep 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change shiftKey to false, so it won't break any existing use case.

altKey:false,
metaKey:false,
},
custom_node_render: null,
expander_style: 'char', // [char | number]
Expand Down
Loading