- Timestamp:
- 2012-02-15T02:44:53+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r4904 r4934 213 213 214 214 if(dragInProgress()) { 215 c = ctrl ? "merge" : "move"; 216 if(osm != null && osm instanceof Node && ctrl) { 217 c += "_to_node"; 218 } 215 // only consider merge if ctrl is pressed and there are nodes in 216 // the selection that could be merged 217 if(!ctrl || getCurrentDataSet().getSelectedNodes().isEmpty()) { 218 c = "move"; 219 break; 220 } 221 // only show merge to node cursor if nearby node and that node is currently 222 // not being dragged 223 final boolean hasTarget = osm != null && osm instanceof Node && !osm.isSelected(); 224 c = hasTarget ? "merge_to_node" : "merge"; 219 225 break; 220 226 } … … 310 316 return needsRepaint; 311 317 318 // CTRL toggles selection, but if while dragging CTRL means merge 319 final boolean isToggleMode = ctrl && !dragInProgress(); 312 320 for(OsmPrimitive x : c) { 313 321 // only highlight primitives that will change the selection 314 322 // when clicked. I.e. don't highlight selected elements unless 315 323 // we are in toggle mode. 316 if( ctrl|| !x.isSelected()) {324 if(isToggleMode || !x.isSelected()) { 317 325 x.setHighlighted(true); 318 326 oldHighlights.add(x); … … 344 352 if (!mv.isActiveLayerVisible()) 345 353 return; 346 354 347 355 // Swing sends random mouseDragged events when closing dialogs by double-clicking their top-left icon on Windows 348 356 // Ignore such false events to prevent issues like #7078 349 if (mouseDownButton == MouseEvent.BUTTON1 && mouseReleaseTime > mouseDownTime) { 350 return; 351 } 357 if (mouseDownButton == MouseEvent.BUTTON1 && mouseReleaseTime > mouseDownTime) 358 return; 352 359 353 360 cancelDrawMode = true; … … 368 375 // If ctrl is pressed we are in merge mode. Look for a nearby node, 369 376 // highlight it and adjust the cursor accordingly. 370 final OsmPrimitive p = ctrl ? (OsmPrimitive)findNodeToMergeTo(e) : null; 377 final boolean canMerge = ctrl && !getCurrentDataSet().getSelectedNodes().isEmpty(); 378 final OsmPrimitive p = canMerge ? (OsmPrimitive)findNodeToMergeTo(e) : null; 371 379 boolean needsRepaint = removeHighlighting(); 372 380 if(p != null) { … … 376 384 } 377 385 mv.setNewCursor(getCursor(MapView.asColl(p)), this); 386 // also update the stored mouse event, so we can display the correct cursor 387 // when dragging a node onto another one and then press CTRL to merge 388 oldEvent = e; 378 389 if(needsRepaint) { 379 390 mv.repaint(); … … 636 647 * selectables nearby. Everything has to be pre-determined for this 637 648 * function; its main purpose is to centralize what the modifiers do. 638 * @param nearSelectables649 * @param hasSelectionNearby 639 650 */ 640 651 private void determineMapMode(boolean hasSelectionNearby) { … … 935 946 if (mode == Mode.select) 936 947 return tr("Release the mouse button to select the objects in the rectangle."); 937 else if (mode == Mode.move) 938 return tr("Release the mouse button to stop moving. Ctrl to merge with nearest node."); 939 else if (mode == Mode.rotate) 948 else if (mode == Mode.move) { 949 final boolean canMerge = !getCurrentDataSet().getSelectedNodes().isEmpty(); 950 final String mergeHelp = canMerge ? (" " + tr("Ctrl to merge with nearest node.")) : ""; 951 return tr("Release the mouse button to stop moving.") + mergeHelp; 952 } else if (mode == Mode.rotate) 940 953 return tr("Release the mouse button to stop rotating."); 941 954 else if (mode == Mode.scale)
Note:
See TracChangeset
for help on using the changeset viewer.