Ticket #2179: PotlatchDrawing FixRandomAborts.patch

File PotlatchDrawing FixRandomAborts.patch, 1.4 KB (added by xeen, 17 years ago)
  • src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

     
    7373    private boolean drawTargetHighlight;
    7474    private boolean drawTargetCursor;
    7575    private Point mousePos;
     76    private Point oldMousePos;
    7677    private Color selectedColor;
    7778
    7879    private Node currentBaseNode;
     
    246247            return;
    247248        if(!Main.map.mapView.isDrawableLayer())
    248249            return;
    249         if(e.getClickCount() > 1) {
     250       
     251        if(e.getClickCount() > 1 && mousePos != null && mousePos.equals(oldMousePos)) {
    250252            // 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
    251255            lastUsedNode = null;
    252256            wayIsFinished = true;
     257
    253258            Main.map.selectSelectTool(true);
    254259            return;
    255260        }
     261        oldMousePos = mousePos;
     262       
    256263        // we copy ctrl/alt/shift from the event just in case our global
    257264        // AWTEvent didn't make it through the security manager. Unclear
    258265        // if that can ever happen but better be safe.