Changeset 7053 in josm for trunk


Ignore:
Timestamp:
2014-05-02T18:14:52+02:00 (6 years ago)
Author:
bastiK
Message:

fixed #9669 - key-press 3 on node goes down to 6 meter

new advanced property zoom_to_selection_min_size_in_meter to
set the minimum width and height of the area (in meter) for the
zoom to selection action "3"

Location:
trunk/src/org/openstreetmap/josm
Files:
2 edited

Legend:

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

    r7012 r7053  
    251251            // Increase the bounding box by up to 100% to give more context.
    252252            v.enlargeBoundingBoxLogarithmically(100);
    253             // Make the bounding box at least 0.0005 degrees (≈ 56 m) wide to
     253            // Make the bounding box at least 100 meter wide to
    254254            // ensure reasonable zoom level when zooming onto single nodes.
    255             v.enlargeToMinDegrees(0.0005);
     255            v.enlargeToMinSize(Main.pref.getDouble("zoom_to_selection_min_size_in_meter", 100));
    256256            break;
    257257        case "download":
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/BoundingXYVisitor.java

    r6623 r7053  
    163163    /**
    164164     * Specify a degree larger than 0 in order to make the bounding box at least
    165      * the specified amount of degrees high and wide. The value is ignored if the
     165     * the specified size in width and height. The value is ignored if the
    166166     * bounding box is already larger than the specified amount.
    167167     *
     
    172172     * will be centered within the new bounding box.
    173173     *
    174      * @param minDegrees
     174     * @param size minimum width and height in meter
    175175     */
    176     public void enlargeToMinDegrees(double minDegrees) {
     176    public void enlargeToMinSize(double size) {
    177177        if (bounds == null)
    178178            return;
    179 
    180         EastNorth minEnlarge = Main.getProjection().latlon2eastNorth(new LatLon(0, minDegrees));
    181 
    182         visit(bounds.getMin().add(-minEnlarge.east()/2, -minEnlarge.north()/2));
    183         visit(bounds.getMax().add(+minEnlarge.east()/2, +minEnlarge.north()/2));
     179        // convert size from meters to east/north units
     180        double en_size = size * Main.map.mapView.getScale() / Main.map.mapView.getDist100Pixel() * 100;
     181        visit(bounds.getMin().add(-en_size/2, -en_size/2));
     182        visit(bounds.getMax().add(+en_size/2, +en_size/2));
    184183    }
    185184
Note: See TracChangeset for help on using the changeset viewer.