Ticket #17591: 17591-scale-follow.patch

File 17591-scale-follow.patch, 3.4 KB (added by GerdP, 4 years ago)
  • src/org/openstreetmap/josm/gui/NavigatableComponent.java

     
    107107    public static final DoubleProperty PROP_ZOOM_RATIO = new DoubleProperty("zoom.ratio", 2.0);
    108108    /** Divide intervals between native resolution levels to smaller steps if they are much larger than zoom ratio */
    109109    public static final BooleanProperty PROP_ZOOM_INTERMEDIATE_STEPS = new BooleanProperty("zoom.intermediate-steps", true);
     110    /** scale follows native resolution of layer status when layer is created */
     111    public static final BooleanProperty PROP_ZOOM_SCALE_FOLLOWS_NATIVE_RESOLUTION_AT_LOAD = new BooleanProperty(
     112            "zoom.scale-follow-native-resolution-at-load", true);
    110113
    111114    /**
    112115     * The layer which scale is set to.
  • src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java

     
    538538            if (layer instanceof NativeScaleLayer) {
    539539                boolean active = ((NativeScaleLayer) layer) == MainApplication.getMap().mapView.getNativeScaleLayer();
    540540                cb.setSelected(active);
    541                 cb.setToolTipText(active
    542                     ? tr("scale follows native resolution of this layer")
    543                     : tr("scale follows native resolution of another layer (click to set this layer)")
    544                 );
     541                if (MainApplication.getMap().mapView.getNativeScaleLayer() != null) {
     542                    cb.setToolTipText(active
     543                            ? tr("scale follows native resolution of this layer")
     544                            : tr("scale follows native resolution of another layer (click to set this layer)"));
     545                } else {
     546                    cb.setToolTipText(tr("scale does not follow native resolution of any layer (click to set this layer)"));
     547                }
    545548            } else {
    546549                cb.setSelected(false);
    547550                cb.setToolTipText(tr("this layer has no native resolution"));
  • src/org/openstreetmap/josm/gui/layer/AbstractTileSourceLayer.java

     
    9595import org.openstreetmap.josm.gui.ExtendedDialog;
    9696import org.openstreetmap.josm.gui.MainApplication;
    9797import org.openstreetmap.josm.gui.MapView;
     98import org.openstreetmap.josm.gui.NavigatableComponent;
    9899import org.openstreetmap.josm.gui.NavigatableComponent.ZoomChangeListener;
    99100import org.openstreetmap.josm.gui.Notification;
    100101import org.openstreetmap.josm.gui.dialogs.LayerListDialog;
     
    554555        event.getMapView().addMouseListener(adapter);
    555556        MapView.addZoomChangeListener(this);
    556557
    557         if (this instanceof NativeScaleLayer) {
     558        if (this instanceof NativeScaleLayer && NavigatableComponent.PROP_ZOOM_SCALE_FOLLOWS_NATIVE_RESOLUTION_AT_LOAD.get()) {
    558559            event.getMapView().setNativeScaleLayer((NativeScaleLayer) this);
    559560        }
    560561