Changeset 811 in josm for trunk/src/org
- Timestamp:
- 2008-08-20T19:22:55+02:00 (17 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/PasteAction.java
r627 r811 12 12 import java.util.LinkedList; 13 13 import java.util.List; 14 15 import java.awt.event.MouseMotionListener; 16 import javax.swing.JOptionPane; 14 17 15 18 import org.openstreetmap.josm.Main; … … 38 41 39 42 /* Find the middle of the pasteBuffer area */ 40 EastNorth centre = Main.map.mapView.getCenter();41 43 double maxEast = -1E100, minEast = 1E100, maxNorth = -1E100, minNorth = 1E100; 42 44 for (Node n : pasteBuffer.nodes) { … … 48 50 if (north < minNorth) { minNorth = north; } 49 51 } 50 double offsetEast = centre.east() - (maxEast + minEast)/2.0; 51 double offsetNorth = centre.north() - (maxNorth + minNorth)/2.0; 52 53 EastNorth mPosition; 54 if((e.getModifiers() & ActionEvent.CTRL_MASK) ==0){ 55 mPosition = Main.map.mapView.getCenter(); 56 } else { 57 mPosition = Main.map.mapView.getEastNorth(Main.map.mapView.lastMEvent.getX(), Main.map.mapView.lastMEvent.getY()); 58 }; 59 60 double offsetEast = mPosition.east() - (maxEast + minEast)/2.0; 61 double offsetNorth = mPosition.north() - (maxNorth + minNorth)/2.0; 52 62 53 63 HashMap<OsmPrimitive,OsmPrimitive> map = new HashMap<OsmPrimitive,OsmPrimitive>(); -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r805 r811 10 10 import java.awt.Point; 11 11 import java.awt.Transparency; 12 import java.awt.event.MouseEvent; 13 import java.awt.event.MouseMotionListener; 12 14 import java.awt.event.ComponentAdapter; 13 15 import java.awt.event.ComponentEvent; … … 84 86 private Layer activeLayer; 85 87 88 /** 89 * The last event performed by mouse. 90 */ 91 public MouseEvent lastMEvent; 92 86 93 private LinkedList<MapViewPaintable> temporaryLayers = new LinkedList<MapViewPaintable>(); 87 94 … … 127 134 public void selectionChanged(Collection<? extends OsmPrimitive> newSelection) { 128 135 repaint(); 136 } 137 }); 138 139 //store the last mouse action 140 this.addMouseMotionListener(new MouseMotionListener() { 141 public void mouseDragged(MouseEvent e) { 142 mouseMoved(e); 143 } 144 public void mouseMoved(MouseEvent e) { 145 lastMEvent = e; 129 146 } 130 147 });
Note:
See TracChangeset
for help on using the changeset viewer.