Changeset 4617 in josm for trunk/src/org


Ignore:
Timestamp:
2011-11-29T00:55:26+01:00 (13 years ago)
Author:
Don-vip
Message:

fix #7078 - Closing element history dialog moves objects

File:
1 edited

Legend:

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

    r4562 r4617  
    125125    private long mouseDownTime = 0;
    126126    /**
     127     * The pressed button of the user mouse down event.
     128     */
     129    private int mouseDownButton = 0;
     130    /**
     131     * The time of the user mouse down event.
     132     */
     133    private long mouseReleaseTime = 0;
     134    /**
    127135     * The time which needs to pass between click and release before something
    128136     * counts as a move, in milliseconds
     
    336344        if (!mv.isActiveLayerVisible())
    337345            return;
     346       
     347        // Swing sends random mouseDragged events when closing dialogs by double-clicking their top-left icon on Windows
     348        // Ignore such false events to prevent issues like #7078
     349        if (mouseDownButton == MouseEvent.BUTTON1 && mouseReleaseTime > mouseDownTime) {
     350            return;
     351        }
    338352
    339353        cancelDrawMode = true;
     
    648662    public void mousePressed(MouseEvent e) {
    649663        // return early
    650         if (!mv.isActiveLayerVisible() || !(Boolean) this.getValue("active") || e.getButton() != MouseEvent.BUTTON1)
     664        if (!mv.isActiveLayerVisible() || !(Boolean) this.getValue("active") || (mouseDownButton = e.getButton()) != MouseEvent.BUTTON1)
    651665            return;
    652666
     
    705719
    706720        startingDraggingPos = null;
     721        mouseReleaseTime = System.currentTimeMillis();
    707722
    708723        if (mode == Mode.select) {
Note: See TracChangeset for help on using the changeset viewer.