Ctrl + mouse scroll

Hi all, how can I catch ctrl + mouse scrol event on the canvas (diagram) ?

What do you mean by “catch ctrl + mouse scroll event”? Do you mean mouse wheel events that by default scroll the diagram and when modified with the control key zoom the diagram?

Normally mouse wheel events, when no other tool is running, are handled by the ToolManager (which is the Diagram.defaultTool) when its doMouseWheel() method is called. The default implementation of that method is to call Tool.standardMouseWheel(), which does the scrolling or the zooming depending on whether the control button is down.

If you want to change the default behavior of the mouse wheel, perhaps setting the ToolManager.mouseWheelBehavior would be sufficient.

If you want something else, perhaps you want to override the ToolManager.doMouseWheel() method.

Or maybe you mean something entirely different?

I would like to block diagram auto resizing (I mean when I pressing CTRL + mouse wheel).

OK, override ToolManager.doMouseWheel to only call the base method when ! this.diagram.lastInput.control.

Oh, and to clarify: that’s not “resizing” anything, but changing the Diagram.scale, a.k.a. zooming.

thanks ! I knew that wasn’t zooming but scaling :) but one more time thanks !