Changeset 1545 in josm for trunk/src/org/openstreetmap/josm/actions
- Timestamp:
- 2009-04-21T12:28:36+02:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java
r1517 r1545 162 162 163 163 // This happens when nothing is selected, but we still want to highlight the "target node" 164 if(mouseOnExistingNode == null && Main.ds.getSelected().size() == 0 165 && mousePos != null && !shift)164 if (mouseOnExistingNode == null && Main.ds.getSelected().size() == 0 165 && mousePos != null) 166 166 mouseOnExistingNode = Main.map.mapView.getNearestNode(mousePos); 167 167 … … 176 176 177 177 // Insert the node into all the nearby way segments 178 if(mouseOnExistingWays.size() == 0) { 178 if (mouseOnExistingWays.size() == 0) { 179 179 setCursor(Cursors.crosshair); 180 180 return; … … 185 185 // We also need this list for the statusbar help text 186 186 oldHighlights.addAll(mouseOnExistingWays); 187 if(!drawTargetHighlight) return; 188 for(Way w : mouseOnExistingWays) { 187 if (!drawTargetHighlight) return; 188 for (Way w : mouseOnExistingWays) { 189 189 w.highlighted = true; 190 190 } … … 314 314 Node n = null; 315 315 316 if (!ctrl && !shift)316 if (!ctrl) 317 317 n = Main.map.mapView.getNearestNode(mousePos); 318 318 … … 395 395 396 396 // If the above does not apply, the selection is cleared and a new try is started 397 398 399 397 400 boolean extendedWay = false; 398 401 boolean wayIsFinishedTemp = wayIsFinished; 399 402 wayIsFinished = false; 400 if (selection.size() > 0) { 403 404 // don't draw lines if shift is held 405 if (selection.size() > 0 && !shift) { 401 406 Node selectedNode = null; 402 407 Way selectedWay = null; … … 627 632 Main.map.statusLine.setDist(-1); 628 633 629 if (!ctrl && !shift &&mousePos != null) {634 if (!ctrl && mousePos != null) { 630 635 currentMouseNode = Main.map.mapView.getNearestNode(mousePos); 631 636 } … … 821 826 822 827 public void paint(Graphics g, MapView mv) { 823 if (!drawHelperLine || wayIsFinished) return; 828 if (!drawHelperLine || wayIsFinished || shift) return; 824 829 825 830 // sanity checks … … 859 864 * No modifiers: all (Connect, Node Re-Use, Auto-Weld) 860 865 * CTRL: disables node re-use, auto-weld 861 * Shift: d isables node re-use862 * ALT: disablesconnect866 * Shift: do not make connection 867 * ALT: make connection but start new way in doing so 863 868 */ 864 869 … … 877 882 // oldHighlights stores the current highlights. If this 878 883 // list is empty we can assume that we won't do any joins 879 if(ctrl || oldHighlights.isEmpty()) 884 if (ctrl || oldHighlights.isEmpty()) { 880 885 rv = tr("Create new node."); 881 else if(shift) {882 // We already know oldHighlights is not empty, but shift is pressed.883 // We can assume the new node will be joined into an existing way884 rv = trn("Insert new node into way.", "Insert new node into {0} ways.",885 oldHighlights.size(), oldHighlights.size());886 886 } else { 887 887 // oldHighlights may store a node or way, check if it's a node 888 888 OsmPrimitive x = oldHighlights.iterator().next(); 889 if(x instanceof Node) 889 if (x instanceof Node) 890 890 rv = tr("Select node under cursor."); 891 891 else … … 898 898 */ 899 899 if (currentBaseNode != null && !wayIsFinished) { 900 if(alt) 900 if (alt) 901 901 rv += " " + tr("Start new way from last node."); 902 902 else … … 908 908 * Handle special case: Highlighted node == selected node => finish drawing 909 909 */ 910 if(n != null && Main.ds.getSelectedNodes().contains(n)) { 911 if(wayIsFinished) 910 if (n != null && Main.ds.getSelectedNodes().contains(n)) { 911 if (wayIsFinished) 912 912 rv = tr("Select node under cursor."); 913 913 else … … 918 918 * Handle special case: Self-Overlapping or closing way 919 919 */ 920 if(Main.ds.getSelectedWays().size() > 0 && !wayIsFinished && !alt) { 920 if (Main.ds.getSelectedWays().size() > 0 && !wayIsFinished && !alt) { 921 921 Way w = (Way) Main.ds.getSelectedWays().iterator().next(); 922 for(Node m : w.nodes) { 923 if(m.equals(mouseOnExistingNode) || mouseOnExistingWays.contains(w)) { 922 for (Node m : w.nodes) { 923 if (m.equals(mouseOnExistingNode) || mouseOnExistingWays.contains(w)) { 924 924 rv += " " + tr("Finish drawing."); 925 925 break;
Note:
See TracChangeset
for help on using the changeset viewer.