Ignore:
Timestamp:
2013-06-06T01:48:06+02:00 (11 years ago)
Author:
Don-vip
Message:

see #8752 - update distance text in status line when rescaling ways

File:
1 edited

Legend:

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

    r5909 r5991  
    711711            startEN = currentEN; // drag can continue after scaling/rotation
    712712   
     713            if (mode != Mode.rotate && mode != Mode.scale) {
     714                return false;
     715            }
     716           
     717            getCurrentDataSet().beginUpdate();
     718           
    713719            if (mode == Mode.rotate) {
    714                 getCurrentDataSet().beginUpdate();
    715720                if (c instanceof RotateCommand && affectedNodes.equals(((RotateCommand) c).getTransformedNodes())) {
    716721                    ((RotateCommand) c).handleEvent(currentEN);
     
    719724                }
    720725            } else if (mode == Mode.scale) {
    721                 getCurrentDataSet().beginUpdate();
    722726                if (c instanceof ScaleCommand && affectedNodes.equals(((ScaleCommand) c).getTransformedNodes())) {
    723727                    ((ScaleCommand) c).handleEvent(currentEN);
     
    725729                    Main.main.undoRedo.add(new ScaleCommand(selection, currentEN));
    726730                }
    727             } else {
    728                 return false;
     731            }
     732           
     733            Collection<Way> ways = getCurrentDataSet().getSelectedWays();
     734            if (doesImpactStatusLine(affectedNodes, ways)) {
     735                Main.map.statusLine.setDist(ways);
    729736            }
    730737        }
    731738        getCurrentDataSet().endUpdate();
    732739        return true;
     740    }
     741   
     742    private boolean doesImpactStatusLine(Collection<Node> affectedNodes, Collection<Way> selectedWays) {
     743        for (Way w : selectedWays) {
     744            for (Node n : w.getNodes()) {
     745                if (affectedNodes.contains(n)) {
     746                    return true;
     747                }
     748            }
     749        }
     750        return false;
    733751    }
    734752   
Note: See TracChangeset for help on using the changeset viewer.