Changeset 14290 in osm for applications/editors/josm


Ignore:
Timestamp:
2009-03-27T15:48:22+01:00 (15 years ago)
Author:
khris78
Message:

ClickCount in MouseWheelEvent seems to be zero on some OS.
=> replaced the condition to center the zomm in / zoom out by a time based condition.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/agpifoj/src/org/openstreetmap/josm/plugins/agpifoj/ImageDisplay.java

    r13497 r14290  
    9797
    9898        boolean mouseIsDragging = false;
     99        long lastTimeForMousePoint = 0l;
    99100        Point mousePointInImg = null;
    100101
     
    120121
    121122            // Calculate the mouse cursor position in image coordinates, so that we can center the zoom
    122             // on that mouse position.
    123             if (e.getClickCount() == 1 || mousePointInImg == null) {
     123            // on that mouse position.
     124            // To avoid issues when the user tries to zoom in on the image borders, this point is not calculated
     125            // again if there was less than 1.5seconds since the last event.
     126            System.out.println(e);
     127            if (e.getWhen() - lastTimeForMousePoint > 1500 || mousePointInImg == null) {
     128                lastTimeForMousePoint = e.getWhen();
    124129                mousePointInImg = comp2imgCoord(visibleRect, e.getX(), e.getY());
    125130            }
Note: See TracChangeset for help on using the changeset viewer.