Changeset 6019 in josm for trunk/src/org
- Timestamp:
- 2013-06-24T16:15:44+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/DialogsToggleAction.java
r5979 r6019 82 82 Main.pref.put("sidetoolbar.visible", selected); 83 83 } 84 Main.map.mapView.rememberLastPositionOnScreen(); 84 85 } 85 86 } -
trunk/src/org/openstreetmap/josm/gui/MapView.java
r6018 r6019 6 6 import java.awt.AlphaComposite; 7 7 import java.awt.Color; 8 import java.awt.Dimension; 8 9 import java.awt.Graphics; 9 10 import java.awt.Graphics2D; … … 41 42 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 42 43 import org.openstreetmap.josm.data.SelectionChangedListener; 44 import org.openstreetmap.josm.data.coor.EastNorth; 43 45 import org.openstreetmap.josm.data.coor.LatLon; 44 46 import org.openstreetmap.josm.data.osm.DataSet; … … 281 283 } 282 284 285 // remebered geometry of the component 286 private Dimension oldSize = null; 287 private Point oldLoc = null; 288 289 /* 290 * Call this method to keep map position on screen during next repaint 291 */ 292 public void rememberLastPositionOnScreen() { 293 oldSize = getSize(); 294 oldLoc = getLocationOnScreen(); 295 } 296 283 297 /** 284 298 * Adds a GPX layer. A GPX layer is added below the lowest data layer. … … 526 540 return; // no data loaded yet. 527 541 542 // if the position was remembered, we need to adjust center once before repainting 543 if (oldLoc != null && oldSize != null) { 544 Point l1 = getLocationOnScreen(); 545 final EastNorth newCenter = new EastNorth( 546 center.getX()+ (l1.x-oldLoc.x - (oldSize.width-getWidth())/2.0)*getScale(), 547 center.getY()+ (oldLoc.y-l1.y + (oldSize.height-getHeight())/2.0)*getScale() 548 ); 549 oldLoc = null; oldSize = null; 550 zoomTo(newCenter); 551 } 552 528 553 List<Layer> visibleLayers = getVisibleLayersInZOrder(); 529 554
Note:
See TracChangeset
for help on using the changeset viewer.