Changeset 1545 in josm


Ignore:
Timestamp:
Apr 21, 2009 12:28:36 PM (4 years ago)
Author:
framm
Message:

re-instate old "shift" behaviour when drawing (shift can now, again, be used to insert a number of nodes into an existing way *without* connecting them). "alt" and "ctrl" unchanged.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r1517 r1545  
    162162 
    163163        // 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) 
    166166            mouseOnExistingNode = Main.map.mapView.getNearestNode(mousePos); 
    167167 
     
    176176 
    177177        // Insert the node into all the nearby way segments 
    178         if(mouseOnExistingWays.size() == 0) { 
     178        if (mouseOnExistingWays.size() == 0) { 
    179179            setCursor(Cursors.crosshair); 
    180180            return; 
     
    185185        // We also need this list for the statusbar help text 
    186186        oldHighlights.addAll(mouseOnExistingWays); 
    187         if(!drawTargetHighlight) return; 
    188         for(Way w : mouseOnExistingWays) { 
     187        if (!drawTargetHighlight) return; 
     188        for (Way w : mouseOnExistingWays) { 
    189189            w.highlighted = true; 
    190190        } 
     
    314314        Node n = null; 
    315315 
    316         if (!ctrl && !shift) 
     316        if (!ctrl) 
    317317            n = Main.map.mapView.getNearestNode(mousePos); 
    318318 
     
    395395 
    396396        // If the above does not apply, the selection is cleared and a new try is started 
     397         
     398   
     399         
    397400        boolean extendedWay = false; 
    398401        boolean wayIsFinishedTemp = wayIsFinished; 
    399402        wayIsFinished = false; 
    400         if (selection.size() > 0) { 
     403         
     404        // don't draw lines if shift is held 
     405        if (selection.size() > 0 && !shift) { 
    401406            Node selectedNode = null; 
    402407            Way selectedWay = null; 
     
    627632        Main.map.statusLine.setDist(-1); 
    628633 
    629         if (!ctrl && !shift && mousePos != null) { 
     634        if (!ctrl && mousePos != null) { 
    630635            currentMouseNode = Main.map.mapView.getNearestNode(mousePos); 
    631636        } 
     
    821826 
    822827    public void paint(Graphics g, MapView mv) { 
    823         if (!drawHelperLine || wayIsFinished) return; 
     828        if (!drawHelperLine || wayIsFinished || shift) return; 
    824829 
    825830        // sanity checks 
     
    859864         *  No modifiers: all (Connect, Node Re-Use, Auto-Weld) 
    860865         *  CTRL: disables node re-use, auto-weld 
    861          *  Shift: disables node re-use 
    862          *  ALT: disables connect 
     866         *  Shift: do not make connection 
     867         *  ALT: make connection but start new way in doing so 
    863868         */ 
    864869 
     
    877882        // oldHighlights stores the current highlights. If this 
    878883        // list is empty we can assume that we won't do any joins 
    879         if(ctrl || oldHighlights.isEmpty()) 
     884        if (ctrl || oldHighlights.isEmpty()) { 
    880885            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 way 
    884             rv = trn("Insert new node into way.", "Insert new node into {0} ways.", 
    885             oldHighlights.size(), oldHighlights.size()); 
    886886        } else { 
    887887            // oldHighlights may store a node or way, check if it's a node 
    888888            OsmPrimitive x = oldHighlights.iterator().next(); 
    889             if(x instanceof Node) 
     889            if (x instanceof Node) 
    890890                rv = tr("Select node under cursor."); 
    891891            else 
     
    898898         */ 
    899899        if (currentBaseNode != null && !wayIsFinished) { 
    900             if(alt) 
     900            if (alt) 
    901901                rv += " " + tr("Start new way from last node."); 
    902902            else 
     
    908908         * Handle special case: Highlighted node == selected node => finish drawing 
    909909         */ 
    910         if(n != null && Main.ds.getSelectedNodes().contains(n)) { 
    911             if(wayIsFinished) 
     910        if (n != null && Main.ds.getSelectedNodes().contains(n)) { 
     911            if (wayIsFinished) 
    912912                rv = tr("Select node under cursor."); 
    913913            else 
     
    918918         * Handle special case: Self-Overlapping or closing way 
    919919         */ 
    920         if(Main.ds.getSelectedWays().size() > 0 && !wayIsFinished && !alt) { 
     920        if (Main.ds.getSelectedWays().size() > 0 && !wayIsFinished && !alt) { 
    921921            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)) { 
    924924                    rv += " " + tr("Finish drawing."); 
    925925                    break; 
Note: See TracChangeset for help on using the changeset viewer.