Changeset 5052 in josm
- Timestamp:
- 2012-03-08T10:25:23+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/PasteAction.java
r4982 r5052 6 6 import static org.openstreetmap.josm.tools.I18n.tr; 7 7 8 import java.awt.MouseInfo; 9 import java.awt.Point; 8 10 import java.awt.event.ActionEvent; 9 11 import java.awt.event.KeyEvent; … … 20 22 import org.openstreetmap.josm.data.osm.PrimitiveData; 21 23 import org.openstreetmap.josm.data.osm.PrimitiveDeepCopy; 22 import org.openstreetmap.josm.data.osm.PrimitiveDeepCopy.PasteBufferChangedListener;23 24 import org.openstreetmap.josm.data.osm.RelationData; 24 25 import org.openstreetmap.josm.data.osm.RelationMemberData; 25 26 import org.openstreetmap.josm.data.osm.WayData; 27 import org.openstreetmap.josm.data.osm.PrimitiveDeepCopy.PasteBufferChangedListener; 26 28 import org.openstreetmap.josm.gui.ExtendedDialog; 27 29 import org.openstreetmap.josm.gui.layer.Layer; … … 67 69 } 68 70 69 EastNorth mPosition; 70 if((e.getModifiers() & ActionEvent.CTRL_MASK) ==0){ 71 /* adjust the coordinates to the middle of the visible map area */ 72 mPosition = Main.map.mapView.getCenter(); 73 } else { 74 if (Main.map.mapView.lastMEvent != null) { 75 mPosition = Main.map.mapView.getEastNorth(Main.map.mapView.lastMEvent.getX(), Main.map.mapView.lastMEvent.getY()); 76 } else { 77 mPosition = Main.map.mapView.getCenter(); 71 // default to paste in center of map (pasted via menu or cursor not in MapView) 72 EastNorth mPosition = Main.map.mapView.getCenter(); 73 if((e.getModifiers() & ActionEvent.CTRL_MASK) != 0) { 74 final Point mp = MouseInfo.getPointerInfo().getLocation(); 75 final Point tl = Main.map.mapView.getLocationOnScreen(); 76 final Point pos = new Point(mp.x-tl.x, mp.y-tl.y); 77 if(Main.map.mapView.contains(pos)) { 78 mPosition = Main.map.mapView.getEastNorth(pos.x, pos.y); 78 79 } 79 80 }
Note:
See TracChangeset
for help on using the changeset viewer.