Changeset 27475 in osm for applications/editors/josm/plugins/ImproveWayAccuracy
- Timestamp:
- 2012-01-16T06:00:27+01:00 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/ImproveWayAccuracy/src/org/openstreetmap/josm/plugins/iwa/IWAMode.java
r27474 r27475 95 95 private final BasicStroke moveNodeStroke; 96 96 private final BasicStroke addNodeStroke; 97 private final BasicStroke deleteNodeStroke; 97 98 98 99 private boolean selectionChangedBlocked = false; … … 125 126 addNodeStroke = new BasicStroke(1, BasicStroke.CAP_BUTT, 126 127 BasicStroke.JOIN_MITER); 128 deleteNodeStroke = new BasicStroke(1, BasicStroke.CAP_BUTT, 129 BasicStroke.JOIN_MITER); 127 130 } 128 131 … … 193 196 return tr("Select a way that you want to make more accurate."); 194 197 } else { 195 if (!ctrl) 196 return tr("Click to move the highlighted node. Hold Ctrl to add new nodes."); 198 if (ctrl) 199 return tr("Click to add a new node. Release Ctrl to move existing nodes or hold Alt to delete."); 200 else if (alt) 201 return tr("Click to delete the highlighted node. Release Alt to move existing nodes or hold Ctrl to add new nodes."); 197 202 else 198 return tr("Click to add a new node. Release Ctrl to move existing nodes.");203 return tr("Click to move the highlighted node. Hold Ctrl to add new nodes, or Alt to delete."); 199 204 } 200 205 } … … 255 260 // Finding endpoints 256 261 Point p1 = null, p2 = null; 257 if (c andidateSegment != null) {262 if (ctrl && candidateSegment != null) { 258 263 g.setStroke(addNodeStroke); 259 264 p1 = mv.getPoint(candidateSegment.getFirstNode()); 260 265 p2 = mv.getPoint(candidateSegment.getSecondNode()); 261 } else if ( candidateNode != null) {266 } else if (!alt && !ctrl && candidateNode != null) { 262 267 g.setStroke(moveNodeStroke); 263 268 List<Pair<Node, Node>> wpps = targetWay.getNodePairs(false); … … 270 275 break; 271 276 } 272 } 277 } else if (alt && !ctrl && candidateNode != null) { 278 g.setStroke(deleteNodeStroke); 279 List<Node> nodes = targetWay.getNodes(); 280 int index = nodes.indexOf(candidateNode); 281 282 // Only draw line if node is not first and/or last 283 if (index != 0 && index != (nodes.size() - 1)) { 284 p1 = mv.getPoint(nodes.get(index - 1)); 285 p2 = mv.getPoint(nodes.get(index + 1)); 286 } 287 // TODO: indicate what part that will be deleted? (for end nodes) 288 } 289 273 290 274 291 // Drawing preview lines 275 292 GeneralPath b = new GeneralPath(); 293 if (alt && !ctrl) { 294 // In delete mode 295 if (p1 != null && p2 != null) { 296 b.moveTo(p1.x, p1.y); 297 b.lineTo(p2.x, p2.y); 298 } 299 } 300 else { 301 // In add or move mode 276 302 if (p1 != null) { 277 303 b.moveTo(mousePos.x, mousePos.y); … … 281 307 b.moveTo(mousePos.x, mousePos.y); 282 308 b.lineTo(p2.x, p2.y); 309 } 283 310 } 284 311 g.draw(b); … … 417 444 Main.main.undoRedo.add(new SequenceCommand(text, virtualCmds)); 418 445 419 } else if(alt && ctrl && candidateNode != null) { 446 } else if(alt && !ctrl && candidateNode != null) { 447 // Deleting the highlighted node 420 448 421 449 //check to see if node has interesting keys … … 490 518 ctrl = (e.getModifiers() & ActionEvent.CTRL_MASK) != 0; 491 519 shift = (e.getModifiers() & ActionEvent.SHIFT_MASK) != 0; 492 alt = (e.getModifiers() & ActionEvent.ALT_MASK) != 0; 520 // accept either Alt key (including AltGr) 521 alt = ((e.getModifiers() & (ActionEvent.ALT_MASK|InputEvent.ALT_GRAPH_MASK)) != 0); 493 522 } 494 523 … … 506 535 : cursorSelectHover, this); 507 536 } else if (state == State.improving) { 508 if(alt && ctrl) {537 if(alt && !ctrl) { 509 538 mv.setNewCursor(cursorImproveDelete, this); 510 539 } else if(shift || dragging) {
Note:
See TracChangeset
for help on using the changeset viewer.