Ticket #6447: ticket-6447-demofix.patch

File ticket-6447-demofix.patch, 1.5 KB (added by olejorgenb, 15 years ago)
  • src/org/openstreetmap/josm/actions/mapmode/SelectAction.java

    diff --git a/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java b/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
    index 3d8fd76..a11f049 100644
    a b public class SelectAction extends MapMode implements AWTEventListener, Selection  
    426426            }
    427427
    428428            if (mode == Mode.move) {
    429                 if (c instanceof MoveCommand && affectedNodes.equals(((MoveCommand) c).getParticipatingPrimitives())) {
     429                boolean reuseMoveCommand = false;
     430                if (c instanceof MoveCommand && affectedNodes.size() == ((MoveCommand) c).getParticipatingPrimitives().size()) {
     431                    MoveCommand mc = (MoveCommand) c;
     432                    int matchCount = 0;
     433                    for (Node an : affectedNodes) {
     434                        for (Node pn : mc.getParticipatingPrimitives()) {
     435                            if (pn.equals(an) && pn.getDataSet() == an.getDataSet()) {
     436                                matchCount++;
     437                            }
     438                        }
     439                    }
     440                    if(matchCount == affectedNodes.size() && matchCount == mc.getParticipatingPrimitives().size()) {
     441                        reuseMoveCommand = true;
     442                    }
     443                }
     444                if (reuseMoveCommand) {
    430445                    ((MoveCommand) c).moveAgain(dx, dy);
    431446                } else {
    432447                    Main.main.undoRedo.add(