Changeset 13546 in josm


Ignore:
Timestamp:
2018-03-19T20:57:48+01:00 (5 weeks ago)
Author:
Don-vip
Message:

fix #16053, see #15849 - make ImageryAdjustAction robust to change of map mode via shortcut

File:
1 edited

Legend:

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

    r13433 r13546  
    5353    private MapMode oldMapMode;
    5454    private boolean exitingMode;
     55    private boolean restoreOldMode;
    5556
    5657    /**
     
    113114    @Override
    114115    public void exitMode() {
     116        // do not restore old mode here - this is called when the new mode is already known.
     117        restoreOldMode = false;
     118        doExitMode();
     119    }
     120
     121    private void exitModeAndRestoreOldMode() {
     122        restoreOldMode = true;
     123        doExitMode();
     124        restoreOldMode = false;
     125    }
     126
     127    private void doExitMode() {
    115128        exitingMode = true;
    116129        super.exitMode();
     
    120133            }
    121134            hideOffsetDialog();
    122             // do not restore old mode here - this is called when the new mode is already known.
    123135        }
    124136        removeListeners();
     
    352364                return;
    353365            if (oldMapMode != null) {
    354                 map.selectMapMode(oldMapMode);
     366                if (restoreOldMode) {
     367                    map.selectMapMode(oldMapMode);
     368                }
    355369                oldMapMode = null;
    356370            } else if (!exitingMode && !map.selectSelectTool(false)) {
    357                 exitMode();
     371                exitModeAndRestoreOldMode();
    358372                map.mapMode = null;
    359373            }
Note: See TracChangeset for help on using the changeset viewer.