Changeset 452 in josm for trunk/src/org


Ignore:
Timestamp:
2007-11-04T14:14:48+01:00 (17 years ago)
Author:
framm
Message:
  • fix moving of selected groups of objects (JOSM always cleared selection and selected clicked object which was wrong)
File:
1 edited

Legend:

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

    r424 r452  
    7373                selectionManager = new SelectionManager(this, false, mapFrame.mapView);         
    7474                try { initialMoveDelay = Integer.parseInt(Main.pref.get("edit.initial-move-delay","100")); } catch (NumberFormatException x) {};
    75 
    76 
    7775        }
    7876
     
    197195                mouseDownTime = System.currentTimeMillis();
    198196
     197                // find the object that was clicked on.
     198                // if the object is not part of the current selection, clear current
     199                // selection before proceeding.
     200                Collection<OsmPrimitive> osmColl = null;
    199201                OsmPrimitive osm = Main.map.mapView.getNearest(e.getPoint());
    200                 Collection<OsmPrimitive> osmColl;
    201202                if (osm == null) {
    202203                        osmColl = Collections.emptySet();
     204                        Main.ds.setSelected();
    203205                } else {
    204206                        osmColl = Collections.singleton(osm);
    205                 }
    206 
     207                        if (!Main.ds.getSelected().contains(osm)) Main.ds.setSelected();
     208                }
     209               
    207210                if (ctrl && shift) {
    208                         selectPrims(osmColl, true, false);
     211                        if (Main.ds.getSelected().isEmpty()) selectPrims(osmColl, true, false);
    209212                        mode = Mode.rotate;
    210213                        setCursor(ImageProvider.getCursor("rotate", null));
    211                 } else if (osm != null) {
    212                         selectPrims(osmColl, shift, ctrl);
     214                } else if (!osmColl.isEmpty()) {
     215                        if (Main.ds.getSelected().isEmpty()) selectPrims(osmColl, shift, ctrl);
    213216                        mode = Mode.move;
    214217                } else {
Note: See TracChangeset for help on using the changeset viewer.