Changeset 8790 in josm for trunk/src/org/openstreetmap/josm


Ignore:
Timestamp:
2015-09-23T20:50:04+02:00 (9 years ago)
Author:
simon04
Message:

fix #11890 - "Add Node..." should automatically center on the newly created node if outside of view

File:
1 edited

Legend:

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

    r6977 r8790  
    77import java.awt.event.ActionEvent;
    88import java.awt.event.KeyEvent;
     9import java.util.Collections;
    910
    1011import org.openstreetmap.josm.Main;
     
    1213import org.openstreetmap.josm.data.coor.LatLon;
    1314import org.openstreetmap.josm.data.osm.Node;
     15import org.openstreetmap.josm.data.osm.OsmPrimitive;
    1416import org.openstreetmap.josm.gui.dialogs.LatLonDialog;
    1517import org.openstreetmap.josm.tools.Shortcut;
     
    6466        Main.main.undoRedo.add(new AddCommand(nnew));
    6567        getCurrentDataSet().setSelected(nnew);
    66         Main.map.mapView.repaint();
     68        if (Main.map.mapView.getRealBounds().contains(nnew.getCoor())) {
     69            Main.map.mapView.repaint();
     70        } else {
     71            AutoScaleAction.zoomTo(Collections.<OsmPrimitive>singleton(nnew));
     72        }
    6773    }
    6874
Note: See TracChangeset for help on using the changeset viewer.