Changeset 18767 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2023-06-22T22:13:03+02:00 (13 months ago)
Author:
taylor.smock
Message:

Fix #23015, see #2483: Right click (map move) + scale/rotate modes should not interfere with each other

The workaround added for #2483 (r1634, Java 5) does not appear to be needed
anymore (tested with a Magic Mouse in one-button mode under Java 8). Removing
the workaround fixes the behavior whereby a right-click will cause the
scale/rotate mode to be enabled.

To fix extraneous commands being generated during a map pan when scale/rotate
mode is enabled, we check to see if the right mouse button is down in
updateCommandWhileDragging.

File:
1 edited

Legend:

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

    r18665 r18767  
    2424
    2525import javax.swing.JOptionPane;
     26import javax.swing.SwingUtilities;
    2627
    2728import org.openstreetmap.josm.actions.MergeNodesAction;
     
    480481    @Override
    481482    public void mouseMoved(MouseEvent e) {
    482         // Mac OSX simulates with ctrl + mouse 1 the second mouse button hence no dragging events get fired.
    483         if (PlatformManager.isPlatformOsx() && (mode == Mode.ROTATE || mode == Mode.SCALE)) {
    484             mouseDragged(e);
    485             return;
    486         }
    487483        oldEvent = e;
    488484        if (giveUserFeedback(e)) {
     
    571567            virtualManager.createMiddleNodeFromVirtual(currentEN);
    572568        } else {
    573             if (!updateCommandWhileDragging(currentEN)) return;
     569            if (!updateCommandWhileDragging(e, currentEN)) return;
    574570        }
    575571
     
    713709     * Create or update data modification command while dragging mouse - implementation of
    714710     * continuous moving, scaling and rotation
     711     * @param mouseEvent The triggering mouse event
    715712     * @param currentEN - mouse position
    716713     * @return status of action (<code>true</code> when action was performed)
    717714     */
    718     private boolean updateCommandWhileDragging(EastNorth currentEN) {
     715    private boolean updateCommandWhileDragging(MouseEvent mouseEvent, EastNorth currentEN) {
    719716        // Currently we support only transformations which do not affect relations.
    720717        // So don't add them in the first place to make handling easier
     
    789786            startEN = currentEN; // drag can continue after scaling/rotation
    790787
    791             if (mode != Mode.ROTATE && mode != Mode.SCALE) {
     788            if (mode != Mode.ROTATE && mode != Mode.SCALE || SwingUtilities.isRightMouseButton(mouseEvent)) {
    792789                return false;
    793790            }
Note: See TracChangeset for help on using the changeset viewer.