hizzgdev / jsmind

a mind mapping library built by javascript
http://hizzgdev.github.io/jsmind/
Other
3.47k stars 867 forks source link

Debug mousewheel_handle event & programmable mouse zoom key #629

Open smonsarr opened 2 months ago

smonsarr commented 2 months ago

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:

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
        }
    }
}
hizzgdev commented 1 month ago

Also, you may need to run npm run format to format the code, and update unit test to make npm run test-es6 success. Thanks!