Ticket #7991: 7991-DualAlignFixes.patch
File 7991-DualAlignFixes.patch, 2.3 KB (added by , 11 years ago) |
---|
-
src/org/openstreetmap/josm/actions/mapmode/ExtrudeAction.java
179 179 /** Dual alignment reference segments */ 180 180 private ReferenceSegment dualAlignSegment1, dualAlignSegment2; 181 181 /** {@code true}, if new segment was collapsed */ 182 private boolean dualAlignSegmentCollapsed ;182 private boolean dualAlignSegmentCollapsed = false; 183 183 // Dual alignment UI stuff 184 184 private final DualAlignChangeAction dualAlignChangeAction; 185 185 private final JCheckBoxMenuItem dualAlignCheckboxMenuItem; … … 547 547 selectedSegment = null; 548 548 moveCommand = null; 549 549 mode = Mode.select; 550 dualAlignSegmentCollapsed = false; 550 551 updateStatusLine(); 551 552 Main.map.mapView.repaint(); 552 553 } … … 589 590 wnew.addNode(selectedSegment.getFirstNode()); 590 591 wnew.addNode(selectedSegment.getSecondNode()); 591 592 wnew.addNode(third); 592 if (newN1en.distance(newN2en)>1e-6) { 593 wnew.addNode(fourth); // rectangle can degrade to triangle for dual alignment 593 if (!dualAlignSegmentCollapsed) { 594 // rectangle can degrade to triangle for dual alignment after collapsing 595 wnew.addNode(fourth); 594 596 } 595 597 // ... and close the way 596 598 wnew.addNode(selectedSegment.getFirstNode()); 597 599 // undo support 598 600 cmds.add(new AddCommand(third)); 599 cmds.add(new AddCommand(fourth)); 601 if (!dualAlignSegmentCollapsed) { 602 cmds.add(new AddCommand(fourth)); 603 } 600 604 cmds.add(new AddCommand(wnew)); 601 605 Command c = new SequenceCommand(tr("Extrude Way"), cmds); 602 606 Main.main.undoRedo.add(c); … … 692 696 } 693 697 694 698 private void joinNodesIfCollapsed(List<Node> changedNodes) { 695 if (!dualAlign Active || newN1en == null || newN2en == null) return;699 if (!dualAlignSegmentCollapsed) return; 696 700 if (newN1en.distance(newN2en) > 1e-6) return; 697 701 // If the dual alignment moved two nodes to the same point, merge them 698 702 Node targetNode = MergeNodesAction.selectTargetNode(changedNodes);