Changeset 19566 in josm
- Timestamp:
- 2026-04-17T06:25:19+02:00 (3 hours ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 3 edited
-
actions/mapmode/SelectAction.java (modified) (3 diffs)
-
command/RotateCommand.java (modified) (3 diffs)
-
command/ScaleCommand.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r19556 r19566 52 52 import org.openstreetmap.josm.gui.MapView; 53 53 import org.openstreetmap.josm.gui.MapViewState.MapViewPoint; 54 import org.openstreetmap.josm.gui.Notification; 54 55 import org.openstreetmap.josm.gui.SelectionManager; 55 56 import org.openstreetmap.josm.gui.SelectionManager.SelectionEnded; … … 793 794 if (mode == Mode.ROTATE) { 794 795 if (c instanceof RotateCommand && affectedNodes.equals(((RotateCommand) c).getTransformedNodes())) { 795 ((RotateCommand) c).handleEvent(currentEN); 796 if (didMouseDrag) { 797 ((RotateCommand) c).handleEvent(currentEN); 798 } else { 799 ((RotateCommand) c).handleUpdate(currentEN); 800 } 796 801 } else { 797 802 UndoRedoHandler.getInstance().add(new RotateCommand(selection, currentEN)); … … 799 804 } else if (mode == Mode.SCALE) { 800 805 if (c instanceof ScaleCommand && affectedNodes.equals(((ScaleCommand) c).getTransformedNodes())) { 801 ((ScaleCommand) c).handleEvent(currentEN); 806 if (didMouseDrag) { 807 ((ScaleCommand) c).handleEvent(currentEN); 808 } else { 809 ((ScaleCommand) c).handleUpdate(currentEN); 810 } 802 811 } else { 803 812 UndoRedoHandler.getInstance().add(new ScaleCommand(selection, currentEN)); -
trunk/src/org/openstreetmap/josm/command/RotateCommand.java
r17632 r19566 26 26 * angle of rotation starting click to pivot 27 27 */ 28 private finaldouble startAngle;28 private double startAngle; 29 29 30 30 /** … … 32 32 */ 33 33 private double rotationAngle; 34 35 private double deltaAngle; 34 36 35 37 /** … … 66 68 public final void handleEvent(EastNorth currentEN) { 67 69 double currentAngle = getAngle(currentEN); 68 rotationAngle = currentAngle - startAngle; 70 rotationAngle = currentAngle - startAngle + deltaAngle; 69 71 transformNodes(); 72 } 73 74 /** 75 * Handle a repeated rotation action where the mouse was moved to a different position 76 * see #24695 77 * @param startEN start cursor position of a repeated rotation 78 */ 79 public void handleUpdate(EastNorth startEN) { 80 deltaAngle = rotationAngle; 81 startAngle = getAngle(startEN); 70 82 } 71 83 -
trunk/src/org/openstreetmap/josm/command/ScaleCommand.java
r17632 r19566 27 27 28 28 /** 29 * scaling factor applied previously 30 */ 31 private double deltaScalingFactor; 32 33 /** 29 34 * World position of the mouse when the user started the command. 30 35 */ 31 private finalEastNorth startEN;36 private EastNorth startEN; 32 37 33 38 /** … … 58 63 @Override 59 64 public final void handleEvent(EastNorth currentEN) { 60 double startAngle = Math.atan2(startEN.east()-pivot.east(), startEN.north()-pivot.north()); 61 double endAngle = Math.atan2(currentEN.east()-pivot.east(), currentEN.north()-pivot.north()); 65 setScalingFactor(deltaScalingFactor + calcScalingFactor(currentEN)); 66 transformNodes(); 67 } 68 69 /** 70 * Handle a repeated scaling action where the mouse was moved to a different position 71 * see #24695 72 * @param newStartEN start cursor position of a repeated scaling 73 */ 74 public void handleUpdate(EastNorth newStartEN) { 75 startEN = newStartEN; 76 deltaScalingFactor = scalingFactor - calcScalingFactor(newStartEN); 77 } 78 79 private double calcScalingFactor(EastNorth currentEN) { 80 double startAngle = Math.atan2(startEN.east() - pivot.east(), startEN.north() - pivot.north()); 81 double endAngle = Math.atan2(currentEN.east() - pivot.east(), currentEN.north() - pivot.north()); 62 82 double startDistance = pivot.distance(startEN); 63 83 double currentDistance = pivot.distance(currentEN); 64 setScalingFactor(Math.cos(startAngle-endAngle) * currentDistance / startDistance); 65 transformNodes(); 84 return Math.cos(startAngle - endAngle) * currentDistance / startDistance; 66 85 } 67 86
Note:
See TracChangeset
for help on using the changeset viewer.
