Group: Forum Members
Last Active: 14 Years Ago
Posts: 9,
Visits: 1
|
I'm trying to figure out how to change the default functionality of the middle mouse button.
I would like to have: 1) Middle button click and drag the view (like the Pan tool) 2) Mouse wheel zoom in / out
I've been looking at deriving from NMouseWheelScrollAndZoomTool and making my own, and then attempting to replace the default tool with my new one, but I'm not convinced that's the right way to do it, or that I'm not doing a whole lot more work than I need to.
Any suggestions or assistance would be appreciated.
Herb.
|
Group: Forum Members
Last Active: 2 Months Ago
Posts: 35,
Visits: 15
|
Hi Arthur,
Regarding your questions:
1) Middle button click and drag the view (like the Pan tool) You can use the Pan tool to do this. You need to set the StartMouseEvent to MiddleButtonDown and then set the EndMouseEvent to MiddleButtonUp. By default the pan tool is configured to do dragging on left mouse button down/up events.
2) Mouse wheel zoom in / out The NMouseWheelScrollAndZoomTool will perform zoom in/out when the ZoomModifierKey (property of the tool) is pressed. By default the ZoomModifierKey is set to Ctrl - so pressing Ctrl and wheeling the wheel will perform zoom/in out. We will hoever revise this behavior for the next release to like this:
property ScrollByDefault; (by default true) when true and no modifier is pressed - scorolls the view when false and no modifier is pressed - zooms the view
property ZoomModifierKey will be renamed to ToggleScrollZoomModifierKey. the modifier key toggles the default scroll or zoom setting.
For now however you can override the NMouseWheelScrollAndZoomTool tool with the following:
1. override the VerifyNewZoomModifierKey to always return true. 2. set the ZoomModifierKey to Keys.None.
This will make the tool always perform wheel zooming. You will however loose the wheel scrolling behavior since it will never be activatable. Send me a personal mail at ivo@nevron.com if you want me to send you a reference code for the NMouseWheelScrollAndZoomTool.
Best regards, Ivo
|