- Timestamp:
- 2011-10-23T19:41:25+02:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r4327 r4539 53 53 import org.openstreetmap.josm.tools.Pair; 54 54 import org.openstreetmap.josm.tools.Shortcut; 55 import org.openstreetmap.josm.tools.Utils; 55 56 56 57 /** 57 * 58 * Mapmode to add nodes, create and extend ways. 58 59 */ 59 60 public class DrawAction extends MapMode implements MapViewPaintable, SelectionChangedListener, AWTEventListener { … … 98 99 updateStatusLine(); 99 100 if ((!drawHelperLine || wayIsFinished) && !drawTargetHighlight) return; 101 // update selection to reflect which way being modified 102 if (currentBaseNode != null && getCurrentDataSet().getSelected().isEmpty() == false) { 103 Way continueFrom = getWayForNode(currentBaseNode); 104 if (alt && continueFrom != null) { 105 getCurrentDataSet().beginUpdate(); // to prevent the selection listener to screw around with the state 106 getCurrentDataSet().addSelected(currentBaseNode); 107 getCurrentDataSet().clearSelection(continueFrom); 108 getCurrentDataSet().endUpdate(); 109 } else if (!alt && continueFrom != null) { 110 getCurrentDataSet().addSelected(continueFrom); 111 } 112 } 100 113 Main.map.mapView.repaint(); 101 114 } … … 294 307 // (this is just a convenience option so that people don't 295 308 // have to switch modes) 296 newSelection.clear(); 297 newSelection.add(n); 309 298 310 getCurrentDataSet().setSelected(n); 311 // If we extend/continue an existing way, select it already now to make it obvious 312 Way continueFrom = getWayForNode(n); 313 if (continueFrom != null) { 314 getCurrentDataSet().addSelected(continueFrom); 315 } 316 299 317 // The user explicitly selected a node, so let him continue drawing 300 318 wayIsFinished = false; … … 718 736 public Way getWayForNode(Node n) { 719 737 Way way = null; 720 for (Way w : OsmPrimitive.getFilteredList(n.getReferrers(), Way.class)) {738 for (Way w : Utils.filteredCollection(n.getReferrers(), Way.class)) { 721 739 if (!w.isUsable() || w.getNodesCount() < 1) { 722 740 continue;
Note:
See TracChangeset
for help on using the changeset viewer.