Changeset 7816 in josm for trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
- Timestamp:
- 2014-12-17T01:49:45+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r7448 r7816 32 32 import org.openstreetmap.josm.data.ProjectionBounds; 33 33 import org.openstreetmap.josm.data.SystemOfMeasurement; 34 import org.openstreetmap.josm.data.ViewportData; 34 35 import org.openstreetmap.josm.data.coor.CachedLatLon; 35 36 import org.openstreetmap.josm.data.coor.EastNorth; … … 182 183 private Polygon paintPoly = null; 183 184 185 protected ViewportData initialViewport; 186 184 187 /** 185 188 * Constructs a new {@code NavigatableComponent}. … … 406 409 407 410 /** 408 * Zoom to the given coordinate. 411 * Zoom to the given coordinate and scale. 412 * 409 413 * @param newCenter The center x-value (easting) to zoom to. 410 414 * @param newScale The scale to use. 411 415 */ 412 416 public void zoomTo(EastNorth newCenter, double newScale) { 417 zoomTo(newCenter, newScale, false); 418 } 419 420 /** 421 * Zoom to the given coordinate and scale. 422 * 423 * @param newCenter The center x-value (easting) to zoom to. 424 * @param newScale The scale to use. 425 * @param initial true if this call initializes the viewport. 426 */ 427 public void zoomTo(EastNorth newCenter, double newScale, boolean initial) { 413 428 Bounds b = getProjection().getWorldBoundsLatLon(); 414 429 LatLon cl = Projections.inverseProject(newCenter); … … 446 461 447 462 if (!newCenter.equals(center) || (scale != newScale)) { 448 pushZoomUndo(center, scale); 449 zoomNoUndoTo(newCenter, newScale); 463 if (!initial) { 464 pushZoomUndo(center, scale); 465 } 466 zoomNoUndoTo(newCenter, newScale, initial); 450 467 } 451 468 } … … 453 470 /** 454 471 * Zoom to the given coordinate without adding to the zoom undo buffer. 472 * 455 473 * @param newCenter The center x-value (easting) to zoom to. 456 474 * @param newScale The scale to use. 457 */ 458 private void zoomNoUndoTo(EastNorth newCenter, double newScale) { 475 * @param initial true if this call initializes the viewport. 476 */ 477 private void zoomNoUndoTo(EastNorth newCenter, double newScale, boolean intial) { 459 478 if (!newCenter.equals(center)) { 460 479 EastNorth oldCenter = center; 461 480 center = newCenter; 462 firePropertyChange(PROPNAME_CENTER, oldCenter, newCenter); 481 if (!intial) { 482 firePropertyChange(PROPNAME_CENTER, oldCenter, newCenter); 483 } 463 484 } 464 485 if (scale != newScale) { 465 486 double oldScale = scale; 466 487 scale = newScale; 467 firePropertyChange(PROPNAME_SCALE, oldScale, newScale); 468 } 469 470 repaint(); 471 fireZoomChanged(); 488 if (!intial) { 489 firePropertyChange(PROPNAME_SCALE, oldScale, newScale); 490 } 491 } 492 493 if (!intial) { 494 repaint(); 495 fireZoomChanged(); 496 } 472 497 } 473 498 … … 595 620 ZoomData zoom = zoomUndoBuffer.pop(); 596 621 zoomRedoBuffer.push(new ZoomData(center, scale)); 597 zoomNoUndoTo(zoom.getCenterEastNorth(), zoom.getScale()); 622 zoomNoUndoTo(zoom.getCenterEastNorth(), zoom.getScale(), false); 598 623 } 599 624 } … … 603 628 ZoomData zoom = zoomRedoBuffer.pop(); 604 629 zoomUndoBuffer.push(new ZoomData(center, scale)); 605 zoomNoUndoTo(zoom.getCenterEastNorth(), zoom.getScale()); 630 zoomNoUndoTo(zoom.getCenterEastNorth(), zoom.getScale(), false); 606 631 } 607 632 }
Note:
See TracChangeset
for help on using the changeset viewer.
