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?

Why do I do it? It happens to be a convenient way for the user to modify a selection box while they are still making it. (It's a rectangle selection of arbitrary orientiation, for selecting GPS points which lay along a straight line - so mouse x and y click drag and release are needed to determine the start and end of the long axis of the rectangle, and the scroll wheel / arrow keys are available if the width of the rectangle needs changing from its default due to e.g. excess spread of GPS points.) The user would not want to scroll or zoom the view during this procedure anyway, so I don't see the harm in taking over the scroll wheel during this operation.

Russell



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

Reply via email to