Ignore:
Timestamp:
2010-10-28T16:40:22+02:00 (14 years ago)
Author:
bastiK
Message:

fixed #5561 (patch by cmuelle8) - wrong node selected after "unglue way"

File:
1 edited

Legend:

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

    r3594 r3642  
    341341        OsmPrimitive osm = null;
    342342
    343         if (single == null) {
    344             single = MapView.asColl(
    345                     mv.getNearestNodeOrWay(e.getPoint(), OsmPrimitive.isSelectablePredicate, false));
    346         }
    347 
    348         if (!single.isEmpty()) {
     343        if (single != null && !single.isEmpty()) {
     344            osm = single.iterator().next();
     345
     346            Point p = e.getPoint();
    349347            boolean waitForMouseUp = Main.pref.getBoolean("mappaint.select.waits-for-mouse-up", false);
    350348            boolean ctrl = (e.getModifiers() & ActionEvent.CTRL_MASK) != 0;
     
    352350                    || Main.pref.getBoolean("selectaction.cycles.multiple.matches", false));
    353351
    354             Point p = e.getPoint();
    355             osm = single.iterator().next();
    356 
    357352            if (!alt) {
    358353                cycleList = MapView.asColl(osm);
     354
    359355                if (waitForMouseUp) {
    360                     // find a selected nearest node or way, not the true nearest..
     356                    // prefer a selected nearest node or way, if possible
    361357                    osm = mv.getNearestNodeOrWay(p, OsmPrimitive.isSelectablePredicate, true);
    362358                }
     
    368364                }
    369365
    370                 if (!waitForMouseUp && cycleList.size()>1) {
     366                if (cycleList.size()>1) {
    371367                    cyclePrims = false;
    372368
     
    380376                    }
    381377
    382                     // for cycle groups of 2, we can toggle to the true nearest
    383                     // primitive on mouse presses, if it is not selected and if ctrl is not used
    384                     // else, if rotation is possible, defer sel change to mouse release
    385                     if (cycleList.size()==2) {
    386                         if (!(old.equals(osm) || ctrl)) {
     378                    // special case:  for cycle groups of 2, we can toggle to the
     379                    // true nearest primitive on mousePressed right away
     380                    if (cycleList.size()==2 && !waitForMouseUp) {
     381                        if (!(osm.equals(old) || osm.isNew() || ctrl)) {
    387382                            cyclePrims = false;
    388383                            osm = old;
    389                         }
     384                        } // else defer toggling to mouseRelease time in those cases:
     385                        /*
     386                         * osm == old        -- the true nearest node is the selected one
     387                         * osm is a new node -- do not break unglue ways in ALT mode
     388                         * ctrl is pressed   -- ctrl generally works on mouseReleased
     389                         */
    390390                    }
    391391                }
Note: See TracChangeset for help on using the changeset viewer.