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


Ignore:
Timestamp:
2016-01-14T23:44:35+01:00 (9 years ago)
Author:
simon04
Message:

fix #12364 - History dialog: fix initial panning to coordinates

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

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/history/CoordinateInfoViewer.java

    r9441 r9453  
    182182    }
    183183
     184    /**
     185     * Pans the map to the old+new coordinate
     186     * @see JMapViewer#setDisplayToFitMapMarkers()
     187     */
     188    public void setDisplayToFitMapMarkers() {
     189        mapViewer.setDisplayToFitMapMarkers();
     190    }
     191
    184192    private static class Updater {
    185193        private final transient HistoryBrowserModel model;
    186194        private final PointInTimeType role;
    187195
    188         public Updater(HistoryBrowserModel model, PointInTimeType role) {
     196        protected Updater(HistoryBrowserModel model, PointInTimeType role) {
    189197            this.model = model;
    190198            this.role = role;
  • trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowser.java

    r8308 r9453  
    1111import javax.swing.JSplitPane;
    1212import javax.swing.JTabbedPane;
     13import javax.swing.event.ChangeEvent;
     14import javax.swing.event.ChangeListener;
    1315
    1416import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    6466        pnl.setLayout(new BorderLayout());
    6567        pnl.add(tpViewers, BorderLayout.CENTER);
     68
     69        tpViewers.addChangeListener(new ChangeListener() {
     70            @Override
     71            public void stateChanged(ChangeEvent e) {
     72                if (tpViewers.getSelectedComponent() == coordinateInfoViewer) {
     73                    // while building the component size is not yet known, thus panning does not give reasonable results
     74                    coordinateInfoViewer.setDisplayToFitMapMarkers();
     75                }
     76            }
     77        });
     78
    6679        return pnl;
    6780    }
Note: See TracChangeset for help on using the changeset viewer.