On 09/20/2012 08:25 AM, Russell Edwards wrote:
On 20/09/12 04:41, Paul Hartmann wrote:

I put your code in SelectAction and MouseWheelListener worked directly.
Not sure if you can easily suppress zoom, though. What is your mapmode
about?

Other plugins have a similar similar setup, e.g. alignways has a
mapmode with MouseListener. In order to catch keystrokes, you should
try AWTEventListener.

Thanks very much -- all working now.

I have also successfully temporarily disabled map zooming  using
Main.map.mapView.getMouseWheelListeners() and looping
Main.map.mapView.removeMouseWheelListener(). I do this when my mode gets
a mousePressed, and then reinstate them all with
Main.map.mapView.addMouseWheelListener() when I get mouseReleased.

Is this allowed? It's a bit sneaky as the listeners are added by
mapView's private member MapMover. Maybe mapView should have public
lockMap() and unlockMap() methods?

Take care that the listeners are added back, when the user switches to a default mapmode, otherwise do what you like, it's your project! ;)
You are welcome to send core patches if needed for a plugin.

Paul


_______________________________________________
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev

Reply via email to