Changeset 6227 in josm for trunk/src/org


Ignore:
Timestamp:
2013-09-09T02:48:51+02:00 (11 years ago)
Author:
Don-vip
Message:

fix #9055 - Changing Paste shortcut to a single key pasted in the center of screen, not at mouse location

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/PasteAction.java

    r6140 r6227  
    88import java.awt.MouseInfo;
    99import java.awt.Point;
    10 import java.awt.Toolkit;
    1110import java.awt.event.ActionEvent;
    1211import java.awt.event.KeyEvent;
     
    8887        // default to paste in center of map (pasted via menu or cursor not in MapView)
    8988        EastNorth mPosition = Main.map.mapView.getCenter();
    90         if((e.getModifiers() & Toolkit.getDefaultToolkit().getMenuShortcutKeyMask()) != 0) {
     89        // We previously checked for modifier to know if the action has been trigerred via shortcut or via menu
     90        // But this does not work if the shortcut is changed to a single key (see #9055)
     91        // Observed behaviour: getActionCommand() returns Action.NAME when triggered via menu, but shortcut text when triggered with it
     92        if (!getValue(NAME).equals(e.getActionCommand())) {
    9193            final Point mp = MouseInfo.getPointerInfo().getLocation();
    9294            final Point tl = Main.map.mapView.getLocationOnScreen();
Note: See TracChangeset for help on using the changeset viewer.