Ticket #23863: 23863_center_view_at_mouse.patch

File 23863_center_view_at_mouse.patch, 1.4 KB (added by felagund, 5 days ago)
  • src/org/openstreetmap/josm/gui/MapMover.java

     
    101101                case "down":
    102102                    nc.zoomTo(new EastNorth(center.east(), newcenter.north()));
    103103                    break;
     104                case "center":
     105                    Optional.ofNullable(nc.getMousePosition()).ifPresent(p -> nc.zoomTo(nc.getEastNorth(p.x, p.y)));
     106                    break;
    104107                default: // Do nothing
    105108                }
    106109            }
    … …  
    143146                Shortcut.registerShortcut("system:movefocusup", tr("Map: {0}", tr("Move up")), KeyEvent.VK_UP, Shortcut.CTRL));
    144147        registerActionShortcut(new ZoomerAction("down"),
    145148                Shortcut.registerShortcut("system:movefocusdown", tr("Map: {0}", tr("Move down")), KeyEvent.VK_DOWN, Shortcut.CTRL));
     149        registerActionShortcut(new ZoomerAction("center"),
     150                Shortcut.registerShortcut("view:centeratmouse", tr("Map: {0}", tr("Center view at mouse position")),
     151                KeyEvent.CHAR_UNDEFINED, Shortcut.NONE));
    146152
    147153        // see #10592 - Disable these alternate shortcuts on OS X because of conflict with system shortcut
    148154        if (!PlatformManager.isPlatformOsx()) {