[OSM-dev] josm apple-click

Steve Coast steve at asklater.com
Tue Oct 16 21:11:48 BST 2007


Frederik

It would be nice if JOSM panned the map on apple-click on macs as  
I've left my USB mouse somewhere. e.isMetaDown() is the test and  
after a few minutes I got it working with the diff below, but I'm  
missing something as it still draws a box to zoom to and then zooms  
on mouseup.... I figured I'd hand it to you rather than dick about  
with it...

Index: src/org/openstreetmap/josm/gui/MapMover.java
===================================================================
--- src/org/openstreetmap/josm/gui/MapMover.java        (revision 392)
+++ src/org/openstreetmap/josm/gui/MapMover.java        (working copy)
@@ -93,8 +93,9 @@
          * If the right (and only the right) mouse button is  
pressed, move the map
          */
         public void mouseDragged(MouseEvent e) {
+    //System.out.println(e.isMetaDown());
                 int offMask = MouseEvent.BUTTON1_DOWN_MASK |  
MouseEvent.BUTTON2_DOWN_MASK;
-               if ((e.getModifiersEx() &  
(MouseEvent.BUTTON3_DOWN_MASK | offMask)) ==  
MouseEvent.BUTTON3_DOWN_MASK) {
+               if (((e.getModifiersEx() &  
(MouseEvent.BUTTON3_DOWN_MASK | offMask)) ==  
MouseEvent.BUTTON3_DOWN_MASK) || e.isMetaDown()) {
                         if (mousePosMove == null)
                                 startMovement(e);
                         EastNorth center = nc.getCenter();
@@ -112,7 +113,7 @@
          */
         @Override public void mousePressed(MouseEvent e) {
                 int offMask = MouseEvent.BUTTON1_DOWN_MASK |  
MouseEvent.BUTTON2_DOWN_MASK;
-               if (e.getButton() == MouseEvent.BUTTON3 &&  
(e.getModifiersEx() & offMask) == 0)
+               if ((e.getButton() == MouseEvent.BUTTON3 &&  
(e.getModifiersEx() & offMask) == 0) || e.isMetaDown())
                         startMovement(e);
         }



have fun,

SteveC | steve at asklater.com | http://www.asklater.com/steve/






More information about the dev mailing list