Changeset 16900 in josm


Ignore:
Timestamp:
2020-08-21T23:25:39+02:00 (4 years ago)
Author:
simon04
Message:

fix #19692 - Zoom mode: zoom in/out depending on rectangle

File:
1 edited

Legend:

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

    r15046 r16900  
    5555        if (r.width >= 3 && r.height >= 3 && MainApplication.isDisplayingMapView()) {
    5656            MapView mv = MainApplication.getMap().mapView;
    57             mv.zoomToFactor(mv.getEastNorth(r.x+r.width/2, r.y+r.height/2), r.getWidth()/mv.getWidth());
     57            final double factor;
     58            if (r.x == e.getPoint().x || r.y == e.getPoint().y) {
     59                factor = mv.getWidth() / r.getWidth(); // zoom out
     60            } else {
     61                factor = r.getWidth() / mv.getWidth(); // zoom in
     62            }
     63            mv.zoomToFactor(mv.getEastNorth(r.x + r.width / 2, r.y + r.height / 2), factor);
    5864        }
    5965    }
Note: See TracChangeset for help on using the changeset viewer.