Changeset 2229 in josm for trunk/src


Ignore:
Timestamp:
2009-10-03T13:47:51+02:00 (15 years ago)
Author:
xeen
Message:

Fix #3634 Selecting with middle mouse button

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r2217 r2229  
    212212                        // of the first middle click)
    213213                        if(isAtOldPosition && middleMouseDown) {
    214                             popupCycleSelection(osms);
     214                            // Hand down mouse modifiers so the SHIFT mod can be
     215                            // handled correctly (see funcion)
     216                            popupCycleSelection(osms, ms.modifiers);
    215217                        }
    216218
     
    295297         * will automatically select the next item and update the map
    296298         * @param osms
    297          */
    298         private final void popupCycleSelection(Collection<OsmPrimitive> osms) {
     299         * @param mouse modifiers
     300         */
     301        private final void popupCycleSelection(Collection<OsmPrimitive> osms, int mods) {
    299302            // Find some items that are required for cycling through
    300303            OsmPrimitive firstItem = null;
     
    310313                if(firstSelected == null && osm.isSelected()) {
    311314                    firstSelected = osm;
     315                }
     316            }
     317
     318            // Clear previous selection if SHIFT (add to selection) is not
     319            // pressed. Cannot use "setSelected()" because it will cause a
     320            // fireSelectionChanged event which is unnecessary at this point.
     321            if((mods & MouseEvent.SHIFT_DOWN_MASK) == 0) {
     322                for(OsmPrimitive o : Main.main.getCurrentDataSet().getSelected()) {
     323                    o.setSelected(false);
    312324                }
    313325            }
Note: See TracChangeset for help on using the changeset viewer.