Changeset 10682 in josm
- Timestamp:
- 2016-07-31T12:28:39+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/DuplicateAction.java
r10606 r10682 35 35 public void actionPerformed(ActionEvent e) { 36 36 PrimitiveTransferData data = PrimitiveTransferData.getDataWithReferences(getLayerManager().getEditDataSet().getSelected()); 37 new OsmTransferHandler().pasteOn(Main.getLayerManager().getEditLayer(), data.getCenter(), new PrimitiveTransferable(data)); 37 new OsmTransferHandler().pasteOn(Main.getLayerManager().getEditLayer(), 38 PasteAction.computePastePosition(e, getValue(NAME)), new PrimitiveTransferable(data)); 38 39 } 39 40 -
trunk/src/org/openstreetmap/josm/actions/PasteAction.java
r10604 r10682 43 43 @Override 44 44 public void actionPerformed(ActionEvent e) { 45 transferHandler.pasteOn(Main.getLayerManager().getEditLayer(), computePastePosition(e, getValue(NAME))); 46 } 47 48 static EastNorth computePastePosition(ActionEvent e, Object name) { 45 49 // default to paste in center of map (pasted via menu or cursor not in MapView) 46 50 EastNorth mPosition = Main.map.mapView.getCenter(); … … 48 52 // But this does not work if the shortcut is changed to a single key (see #9055) 49 53 // Observed behaviour: getActionCommand() returns Action.NAME when triggered via menu, but shortcut text when triggered with it 50 if (e != null && ! getValue(NAME).equals(e.getActionCommand())) {54 if (e != null && !name.equals(e.getActionCommand())) { 51 55 final Point mp = MouseInfo.getPointerInfo().getLocation(); 52 56 final Point tl = Main.map.mapView.getLocationOnScreen(); … … 56 60 } 57 61 } 58 59 transferHandler.pasteOn(Main.getLayerManager().getEditLayer(), mPosition); 62 return mPosition; 60 63 } 61 64
Note:
See TracChangeset
for help on using the changeset viewer.