rabix/cwl-svg

ZoomPlugin()'s onMouseWheel event needs to block the default action. Because if you do not block the default action, scrolling is triggered when zooming is made

Z-J-wang opened this issue · 0 comments

ZoomPlugin()'s onMouseWheel event needs to block the default action. Because if you do not block the default action, scrolling is triggered when zooming is made.

ZoomPlugin.prototype.onMouseWheel = function (event) {
        event.preventDefault();  //  add
        var scale = this.workflow.scale;
        var scaleUpdate = scale - event.deltaY / 500;
        var zoominOut = scaleUpdate < scale;
        var zoomingIn = scaleUpdate > scale;
        if (zoomingIn && this.workflow.maxScale < scaleUpdate) {
            return;
        }
        if (zoominOut && this.workflow.minScale > scaleUpdate) {
            return;
        }
        this.workflow.scaleAtPoint(scaleUpdate, event.clientX, event.clientY);
        event.stopPropagation();
    };