Ignore:
Timestamp:
2022-06-06T20:35:45+02:00 (3 years ago)
Author:
taylor.smock
Message:

Fix #21893: Align movement of objects when the last selected way has two nodes and the ctrl/meta modifier is pressed (patch by cmuelle8, modified)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    r18456 r18468  
    725725                MoveCommand moveCmd = null;
    726726                if (c instanceof MoveCommand && affectedNodes.equals(((MoveCommand) c).getParticipatingPrimitives())) {
     727                    EastNorth clampedEastNorth = currentEN;
     728                    if (platformMenuShortcutKeyMask) {
     729                        Way w = ds.getLastSelectedWay();
     730                        if (w != null && w.getNodesCount() == 2) {
     731                            double clamph = w.firstNode().getEastNorth().heading(w.lastNode().getEastNorth());
     732                            double dh = startEN.heading(currentEN, clamph);
     733                            switch ((int) (dh / (Math.PI/4))) {
     734                            case 1:
     735                            case 2:
     736                                dh -= Math.PI/2;
     737                                break;
     738                            case 3:
     739                            case 4:
     740                                dh += Math.PI;
     741                                break;
     742                            case 5:
     743                            case 6:
     744                                dh += Math.PI/2;
     745                                break;
     746                            }
     747                            clampedEastNorth = currentEN.rotate(startEN, -dh);
     748                        }
     749                    }
    727750                    moveCmd = (MoveCommand) c;
    728751                    moveCmd.saveCheckpoint();
    729                     moveCmd.applyVectorTo(currentEN);
     752                    moveCmd.applyVectorTo(clampedEastNorth);
    730753                } else if (!selection.isEmpty()) {
    731754                    moveCmd = new MoveCommand(selection, startEN, currentEN);
Note: See TracChangeset for help on using the changeset viewer.