Changeset 18554 in josm
- Timestamp:
- 2022-09-08T17:32:45+02:00 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r18487 r18554 43 43 import org.openstreetmap.josm.data.osm.visitor.AllNodesVisitor; 44 44 import org.openstreetmap.josm.data.osm.visitor.paint.WireframeMapRenderer; 45 import org.openstreetmap.josm.data.preferences.BooleanProperty; 46 import org.openstreetmap.josm.data.preferences.CachingProperty; 45 47 import org.openstreetmap.josm.gui.ExtendedDialog; 46 48 import org.openstreetmap.josm.gui.MainApplication; … … 132 134 } 133 135 136 /** Whether nodes should be merged with other primitives by default when they are being dragged */ 137 private static final CachingProperty<Boolean> MERGE_BY_DEFAULT 138 = new BooleanProperty("edit.move.merge-by-default", false).cached(); 139 134 140 private boolean lassoMode; 135 141 private boolean repeatedKeySwitchLassoOption; … … 320 326 // only consider merge if ctrl is pressed and there are nodes in 321 327 // the selection that could be merged 322 if (! platformMenuShortcutKeyMask|| getLayerManager().getEditDataSet().getSelectedNodes().isEmpty()) {328 if (!isMergeRequested() || getLayerManager().getEditDataSet().getSelectedNodes().isEmpty()) { 323 329 c = "move"; 324 330 break; … … 497 503 return; 498 504 505 updateKeyModifiers(e); 506 499 507 cancelDrawMode = true; 500 508 if (mode == Mode.SELECT) { … … 520 528 // If ctrl is pressed we are in merge mode. Look for a nearby node, 521 529 // highlight it and adjust the cursor accordingly. 522 final boolean canMerge = platformMenuShortcutKeyMask&& !getLayerManager().getEditDataSet().getSelectedNodes().isEmpty();530 final boolean canMerge = isMergeRequested() && !getLayerManager().getEditDataSet().getSelectedNodes().isEmpty(); 523 531 final OsmPrimitive p = canMerge ? findNodeToMergeTo(e.getPoint()) : null; 524 532 boolean needsRepaint = removeHighlighting(); … … 892 900 // if small number of elements were moved, 893 901 updateKeyModifiers(e); 894 if ( platformMenuShortcutKeyMask) mergePrims(e.getPoint());902 if (isMergeRequested()) mergePrims(e.getPoint()); 895 903 } 896 904 } … … 939 947 .flatMap(n -> n.referrers(Way.class)) 940 948 .anyMatch(Way::isDisabledAndHidden); 949 } 950 951 /** 952 * Check if dragged node should be merged when moving it over another primitive 953 * @return true if merge is requested 954 */ 955 private boolean isMergeRequested() { 956 return MERGE_BY_DEFAULT.get() ^ platformMenuShortcutKeyMask; 941 957 } 942 958
Note:
See TracChangeset
for help on using the changeset viewer.