Changeset 12182 in josm


Ignore:
Timestamp:
2017-05-15T19:29:29+02:00 (6 months ago)
Author:
michael2402
Message:

Move viewport following option to DrawAction and make it persistent.

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

Legend:

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

    r10413 r12182  
    121121            // "viewport following" mode for tracing long features
    122122            // from aerial imagery or GPS tracks.
    123             if (Main.map.mapView.viewportFollowing) {
     123            if (DrawAction.VIEWPORT_FOLLOWING.get()) {
    124124                Main.map.mapView.smoothScrollTo(newPoint.getEastNorth());
    125125            }
  • trunk/src/org/openstreetmap/josm/actions/ViewportFollowToggleAction.java

    r10453 r12182  
    99
    1010import org.openstreetmap.josm.Main;
     11import org.openstreetmap.josm.actions.mapmode.DrawAction;
    1112import org.openstreetmap.josm.tools.Shortcut;
    1213
     
    3637    public void actionPerformed(ActionEvent e) {
    3738        toggleSelectedState(e);
    38         Main.map.mapView.viewportFollowing = isSelected();
     39        DrawAction.VIEWPORT_FOLLOWING.put(isSelected());
    3940        notifySelectedState();
    4041    }
  • trunk/src/org/openstreetmap/josm/actions/mapmode/DrawAction.java

    r12158 r12182  
    7474public class DrawAction extends MapMode implements MapViewPaintable, SelectionChangedListener, KeyPressReleaseListener, ModifierListener {
    7575
     76    /**
     77     * If this property is set, the draw action moves the viewport when adding new points.
     78     * @since 12182
     79     */
     80    public static final CachingProperty<Boolean> VIEWPORT_FOLLOWING = new BooleanProperty("draw.viewport.following", false).cached();
     81
    7682    private static final Color ORANGE_TRANSPARENT = new Color(Color.ORANGE.getRed(), Color.ORANGE.getGreen(), Color.ORANGE.getBlue(), 128);
    7783
     
    614620        // "viewport following" mode for tracing long features
    615621        // from aerial imagery or GPS tracks.
    616         if (Main.map.mapView.viewportFollowing) {
     622        if (VIEWPORT_FOLLOWING.get()) {
    617623            Main.map.mapView.smoothScrollTo(n.getEastNorth());
    618624        }
  • trunk/src/org/openstreetmap/josm/gui/MapView.java

    r12174 r12182  
    3636
    3737import org.openstreetmap.josm.Main;
     38import org.openstreetmap.josm.actions.mapmode.DrawAction;
    3839import org.openstreetmap.josm.actions.mapmode.MapMode;
    3940import org.openstreetmap.josm.data.Bounds;
     
    184185    }
    185186
     187    /**
     188     * Replaced by the {@link DrawAction#VIEWPORT_FOLLOWING} property
     189     * @deprecated since 12180. Can be remove soon (does any plugin even use this?)
     190     */
     191    @Deprecated
    186192    public boolean viewportFollowing;
    187193
Note: See TracChangeset for help on using the changeset viewer.