jsmind icon indicating copy to clipboard operation
jsmind copied to clipboard

Debug mousewheel_handle event & programmable mouse zoom key

Open smonsarr opened this issue 1 year ago • 1 comments

By default jsmind zooms on mouse wheel when the CTRL key is pressed, this behaviour can be disabled but cannot be modified.

There is one bug in the current implementation : the use of the non-standard mousewheel event rather than the standard wheel event. Some browsers such as Firefox do not support mousewheel. This pull request corrects this.

The current code enables mouse wheel zooming on ctrlKey exclusively. This is a problem as many browsers use this combo in order to zoom the whole viewport and therefore capture this event without passing it down to the web page.

This proposal does two things:

  • It allows one to modify which modifier keys need to be pressed in order to activate mouse wheel zooming
  • The default key combination changed to ctrlKey + shiftKey + mousewheel

The zoom view options now allow : /

let options = {
	view: {
		zoom: {
			min: 0.5,
			max: 2.1,
			step: 0.1,
			ctrlKey:true,
			shiftKey:true,
			altKey:false,
			metaKey:false
		}
	}
}

smonsarr avatar Sep 12 '24 08:09 smonsarr