- Timestamp:
- 2012-08-12T10:49:53+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r5419 r5435 248 248 249 249 virtualManager.clear(); 250 if(mode == Mode.move && virtualManager.setupVirtual(e.getPoint())) { 251 DataSet ds = getCurrentDataSet(); 252 if (ds != null && drawTargetHighlight) { 253 ds.setHighlightedVirtualNodes(virtualManager.virtualWays); 254 } 255 mv.setNewCursor(SelectActionCursor.virtual_node.cursor(), this); 256 // don't highlight anything else if a virtual node will be 257 return repaintIfRequired(newHighlights); 250 if(mode == Mode.move) { 251 if (!dragInProgress() && virtualManager.activateVirtualNodeNearPoint(e.getPoint())) { 252 DataSet ds = getCurrentDataSet(); 253 if (ds != null && drawTargetHighlight) { 254 ds.setHighlightedVirtualNodes(virtualManager.virtualWays); 255 } 256 mv.setNewCursor(SelectActionCursor.virtual_node.cursor(), this); 257 // don't highlight anything else if a virtual node will be 258 return repaintIfRequired(newHighlights); 259 } 258 260 } 259 261 … … 432 434 // so this is not movement, but selection on primitive under cursor 433 435 if (!cancelDrawMode && nearestPrimitive instanceof Way) { 434 virtualManager. setupVirtual(e.getPoint());436 virtualManager.activateVirtualNodeNearPoint(e.getPoint()); 435 437 } 436 438 selectPrims(cycleManager.cycleSetup(nearestPrimitive, e.getPoint()), false, false); … … 523 525 int dp = (int) lastMousePos.distance(e.getX(), e.getY()); 524 526 if (dp < initialMoveThreshold) 525 return; 526 initialMoveThresholdExceeded = true; 527 } 528 527 return; // ignore small drags 528 initialMoveThresholdExceeded = true; //no more ingnoring uintil nex mouse press 529 } 530 if (e.getPoint().equals(lastMousePos)) 531 return; 532 529 533 EastNorth currentEN = mv.getEastNorth(e.getX(), e.getY()); 530 if (e.getPoint().equals(lastMousePos)) 531 return; 532 533 if (virtualManager.hasVirtualWays()) { 534 virtualManager.processVirtualNodeMovements(currentEN); 534 535 if (virtualManager.hasVirtualWaysToBeConstructed()) { 536 virtualManager.createMiddleNodeFromVirtual(currentEN); 535 537 } else { 536 538 if (!updateCommandWhileDragging(currentEN)) return; … … 807 809 // anything if about to drag the virtual node (i.e. !released) but continue if the 808 810 // cursor is only released above a virtual node by accident (i.e. released). See #7018 809 if ((shift && ctrl) || (ctrl && !released) || (virtualManager.hasVirtualWays() && !released)) 811 if ((shift && ctrl) || (ctrl && !released) || (virtualManager.hasVirtualWaysToBeConstructed() && !released)) 810 812 return; 811 813 … … 1034 1036 * <code>virtualWays</code> were setup. 1035 1037 */ 1036 private boolean setupVirtual(Point p) {1038 private boolean activateVirtualNodeNearPoint(Point p) { 1037 1039 if (nodeVirtualSize > 0) { 1038 1040 1039 1041 Collection<WaySegment> selVirtualWays = new LinkedList<WaySegment>(); 1040 1042 Pair<Node, Node> vnp = null, wnp = new Pair<Node, Node>(null, null); … … 1058 1060 } 1059 1061 if (vnp.equals(wnp)) { 1062 // if mutiple line segments have the same points, 1063 // add all segments to be splitted to virtualWays list 1064 // if some lines are selected, only their segments will go to virtualWays 1060 1065 (w.isSelected() ? selVirtualWays : virtualWays).add(ws); 1061 1066 } … … 1072 1077 } 1073 1078 1074 private void processVirtualNodeMovements(EastNorth currentEN) {1079 private void createMiddleNodeFromVirtual(EastNorth currentEN) { 1075 1080 Collection<Command> virtualCmds = new LinkedList<Command>(); 1076 1081 virtualCmds.add(new AddCommand(virtualNode)); … … 1099 1104 } 1100 1105 1101 private boolean hasVirtualWays() { 1106 private boolean hasVirtualWaysToBeConstructed() { 1102 1107 return !virtualWays.isEmpty(); 1103 1108 }
Note:
See TracChangeset
for help on using the changeset viewer.