Ignore:
Timestamp:
2010-01-07T18:20:47+01:00 (14 years ago)
Author:
mjulius
Message:

fixes #1653 - zoom to the previously shown area
This adds menu entries and the shortcuts '8' and '9' to zoom to the previous and next areas. See also http://josm.openstreetmap.de/wiki/Help/Menu/View

File:
1 edited

Legend:

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

    r2711 r2758  
    2828public class AutoScaleAction extends JosmAction {
    2929
    30     public static final String[] MODES = { marktr("data"), marktr("layer"), marktr("selection"), marktr("conflict"), marktr("download") };
     30    public static final String[] MODES = {
     31        marktr("data"),
     32        marktr("layer"),
     33        marktr("selection"),
     34        marktr("conflict"),
     35        marktr("download"),
     36        marktr("previous"),
     37        marktr("next")};
    3138
    3239    /**
     
    8188            shortcut = KeyEvent.VK_5;
    8289        }
     90        if (mode.equals("previous")) {
     91            shortcut = KeyEvent.VK_8;
     92        }
     93        if (mode.equals("next")) {
     94            shortcut = KeyEvent.VK_9;
     95        }
    8396
    8497        return shortcut;
     
    99112        } else if (mode.equals("conflict")) {
    100113            putValue("help", ht("/Action/ZoomToConflict"));
    101         }else if (mode.equals("download")) {
     114        } else if (mode.equals("download")) {
    102115            putValue("help", ht("/Action/ZoomToDownload"));
     116        } else if (mode.equals("previous")) {
     117            putValue("help", ht("/Action/ZoomPrevious"));
     118        } else if (mode.equals("next")) {
     119            putValue("help", ht("/Action/ZoomNext"));
    103120        }
    104121    }
     
    106123    public void autoScale()  {
    107124        if (Main.map != null) {
    108             BoundingXYVisitor bbox = getBoundingBox();
    109             if (bbox != null && bbox.getBounds() != null) {
    110                 Main.map.mapView.recalculateCenterScale(bbox);
     125            if (mode.equals("previous")) {
     126                Main.map.mapView.zoomPrevious();
     127            } else if (mode.equals("next")) {
     128                Main.map.mapView.zoomNext();
     129            } else {
     130                BoundingXYVisitor bbox = getBoundingBox();
     131                if (bbox != null && bbox.getBounds() != null) {
     132                    Main.map.mapView.recalculateCenterScale(bbox);
     133                }
    111134            }
    112135        }
Note: See TracChangeset for help on using the changeset viewer.