Changeset 5555 in josm for trunk/src


Ignore:
Timestamp:
2012-11-03T16:53:05+01:00 (12 years ago)
Author:
akks
Message:

Draw mode: moving over way segment with CTRL now chooses is for angle snapping like right click (when angle snapping is on)

File:
1 edited

Legend:

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

    r5512 r5555  
    378378            Point curMousePos = e.getPoint();
    379379            if (curMousePos.equals(rightClickPressPos)) {
    380                 WaySegment seg = Main.map.mapView.getNearestWaySegment(curMousePos, OsmPrimitive.isSelectablePredicate);
    381                 if (seg!=null) {
    382                     snapHelper.setBaseSegment(seg);
    383                     computeHelperLine();
    384                     redrawIfRequired();
    385                 }
     380                tryToSetBaseSegmentForAngleSnap();
    386381            }
    387382            return;
     
    756751        updateKeyModifiers(e);
    757752        mousePos = e.getPoint();
    758 
     753        if (snapHelper.isSnapOn() && ctrl)
     754            tryToSetBaseSegmentForAngleSnap();
     755         
    759756        computeHelperLine();
    760757        addHighlighting();
     758    }
     759   
     760    /**
     761     * This method is used to detect segment under mouse and use it as reference for angle snapping
     762     */
     763    private void tryToSetBaseSegmentForAngleSnap() {
     764        WaySegment seg = Main.map.mapView.getNearestWaySegment(mousePos, OsmPrimitive.isSelectablePredicate);
     765        if (seg!=null) {
     766            snapHelper.setBaseSegment(seg);
     767        }
    761768    }
    762769
Note: See TracChangeset for help on using the changeset viewer.