Changeset 1412 in josm
- Timestamp:
- 2009-02-15T21:29:01+01:00 (16 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions/mapmode
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r1409 r1412 74 74 private boolean drawTargetCursor; 75 75 private Point mousePos; 76 private Point oldMousePos; 76 77 private Color selectedColor; 77 78 … … 247 248 if(!Main.map.mapView.isDrawableLayer()) 248 249 return; 249 if(e.getClickCount() > 1) { 250 251 if(e.getClickCount() > 1 && mousePos != null && mousePos.equals(oldMousePos)) { 250 252 // A double click equals "user clicked last node again, finish way" 253 // Change draw tool only if mouse position is nearly the same, as 254 // otherwise fast clicks will count as a double click 251 255 lastUsedNode = null; 252 256 wayIsFinished = true; 257 253 258 Main.map.selectSelectTool(true); 254 259 return; 255 260 } 261 oldMousePos = mousePos; 262 256 263 // we copy ctrl/alt/shift from the event just in case our global 257 264 // AWTEvent didn't make it through the security manager. Unclear -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r1405 r1412 10 10 import java.awt.event.KeyEvent; 11 11 import java.awt.event.MouseEvent; 12 import java.util.ArrayList; 12 13 import java.util.Collection; 13 14 import java.util.Collections; 14 15 import java.util.LinkedList; 16 import java.util.List; 15 17 16 18 import javax.swing.JOptionPane; … … 57 59 private long mouseDownTime = 0; 58 60 private boolean didMove = false; 61 private boolean cancelDrawMode = false; 59 62 Node virtualNode = null; 60 63 WaySegment virtualWay = null; … … 142 145 */ 143 146 @Override public void mouseDragged(MouseEvent e) { 147 cancelDrawMode = true; 144 148 if (mode == Mode.select) return; 145 149 … … 279 283 */ 280 284 @Override public void mousePressed(MouseEvent e) { 285 cancelDrawMode = false; 281 286 if (! (Boolean)this.getValue("active")) return; 282 287 if (e.getButton() != MouseEvent.BUTTON1) … … 329 334 if (mode == Mode.select) { 330 335 selectionManager.unregister(Main.map.mapView); 331 if(Main.ds.getSelected().size() == 0) 336 337 // Select Draw Tool if no selection has been made 338 if(Main.ds.getSelected().size() == 0 && !cancelDrawMode) { 332 339 Main.map.selectDrawTool(true); 333 340 return; 341 } 334 342 } 335 343 restoreCursor(); … … 342 350 Main.map.mapView.getNearestCollection(e.getPoint()), 343 351 shift, ctrl); 352 353 // If the user double-clicked a node, change to draw mode 354 List<OsmPrimitive> sel = new ArrayList<OsmPrimitive>(Main.ds.getSelected()); 355 if(e.getClickCount() >=2 && sel.size() == 1 && sel.get(0) instanceof Node) { 356 // We need to do it like this as otherwise drawAction will see a double 357 // click and switch back to SelectMode 358 Main.worker.execute(new Runnable(){ 359 public void run() { 360 Main.map.selectDrawTool(true); 361 } 362 }); 363 return; 364 } 344 365 } else { 345 366 Collection<OsmPrimitive> selection = Main.ds.getSelected(); … … 402 423 } 403 424 } 404 425 405 426 @Override public boolean layerIsSupported(Layer l) { 406 427 return l instanceof OsmDataLayer;
Note:
See TracChangeset
for help on using the changeset viewer.