Changeset 454 in josm for trunk/src/org/openstreetmap/josm/actions
- Timestamp:
- 2007-11-04T21:22:34+01:00 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r452 r454 45 45 private Mode mode = null; 46 46 private long mouseDownTime = 0; 47 private boolean didMove = false; 47 48 48 49 /** … … 175 176 Main.map.mapView.repaint(); 176 177 mousePos = e.getPoint(); 178 179 didMove = true; 177 180 } 178 181 … … 194 197 195 198 mouseDownTime = System.currentTimeMillis(); 196 197 // find the object that was clicked on. 198 // if the object is not part of the current selection, clear current 199 // selection before proceeding. 200 Collection<OsmPrimitive> osmColl = null; 201 OsmPrimitive osm = Main.map.mapView.getNearest(e.getPoint()); 202 if (osm == null) { 203 osmColl = Collections.emptySet(); 204 Main.ds.setSelected(); 205 } else { 206 osmColl = Collections.singleton(osm); 207 if (!Main.ds.getSelected().contains(osm)) Main.ds.setSelected(); 208 } 209 199 didMove = false; 200 201 Collection<OsmPrimitive> osmColl = 202 Main.map.mapView.getNearestCollection(e.getPoint()); 203 210 204 if (ctrl && shift) { 211 205 if (Main.ds.getSelected().isEmpty()) selectPrims(osmColl, true, false); … … 213 207 setCursor(ImageProvider.getCursor("rotate", null)); 214 208 } else if (!osmColl.isEmpty()) { 215 if (Main.ds.getSelected().isEmpty()) selectPrims(osmColl, shift, ctrl); 209 // Only add to selection for now, we only do replace and remove in 210 // mouseReleased if the user didn't try to move. 211 selectPrims(osmColl, true, ctrl); 216 212 mode = Mode.move; 217 213 } else { … … 239 235 if (mode == Mode.move) { 240 236 boolean ctrl = (e.getModifiers() & ActionEvent.CTRL_MASK) != 0; 241 if (ctrl) { 237 boolean shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0; 238 if (!didMove) { 239 selectPrims( 240 Main.map.mapView.getNearestCollection(e.getPoint()), 241 shift, ctrl); 242 } else if (ctrl) { 242 243 Collection<OsmPrimitive> selection = Main.ds.getSelected(); 243 244 Collection<Node> affectedNodes = AllNodesVisitor.getAllNodes(selection);
Note:
See TracChangeset
for help on using the changeset viewer.