- Timestamp:
- 2019-05-03T15:27:07+02:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MapView.java
r14607 r15041 684 684 } 685 685 686 if (getCenter() == null) 686 EastNorth oldCenter = getCenter(); 687 if (oldCenter == null) 687 688 return false; // no data loaded yet. 688 689 … … 691 692 Point l1 = getLocationOnScreen(); 692 693 final EastNorth newCenter = new EastNorth( 693 getCenter().getX()+ (l1.x-oldLoc.x - (oldSize.width-getWidth())/2.0)*getScale(),694 getCenter().getY()+ (oldLoc.y-l1.y + (oldSize.height-getHeight())/2.0)*getScale()694 oldCenter.getX()+ (l1.x-oldLoc.x - (oldSize.width-getWidth())/2.0)*getScale(), 695 oldCenter.getY()+ (oldLoc.y-l1.y + (oldSize.height-getHeight())/2.0)*getScale() 695 696 ); 696 697 oldLoc = null; oldSize = null; -
trunk/src/org/openstreetmap/josm/gui/MapViewState.java
r14273 r15041 740 740 public MapViewPoint getLineEntry(MapViewPoint start, MapViewPoint end) { 741 741 ProjectionBounds bounds = getProjectionBounds(); 742 if (bounds.contains(start.getEastNorth())) { 742 EastNorth enStart = start.getEastNorth(); 743 if (bounds.contains(enStart)) { 743 744 return start; 744 745 } 745 746 746 double dx = end.getEastNorth().east() - start.getEastNorth().east(); 747 EastNorth enEnd = end.getEastNorth(); 748 double dx = enEnd.east() - enStart.east(); 747 749 double boundX = dx > 0 ? bounds.minEast : bounds.maxEast; 748 EastNorth borderIntersection = Geometry.getSegmentSegmentIntersection( start.getEastNorth(), end.getEastNorth(),750 EastNorth borderIntersection = Geometry.getSegmentSegmentIntersection(enStart, enEnd, 749 751 new EastNorth(boundX, bounds.minNorth), 750 752 new EastNorth(boundX, bounds.maxNorth)); … … 753 755 } 754 756 755 double dy = en d.getEastNorth().north() - start.getEastNorth().north();757 double dy = enEnd.north() - enStart.north(); 756 758 double boundY = dy > 0 ? bounds.minNorth : bounds.maxNorth; 757 borderIntersection = Geometry.getSegmentSegmentIntersection( start.getEastNorth(), end.getEastNorth(),759 borderIntersection = Geometry.getSegmentSegmentIntersection(enStart, enEnd, 758 760 new EastNorth(bounds.minEast, boundY), 759 761 new EastNorth(bounds.maxEast, boundY)); -
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r14995 r15041 680 680 newCenter = newCenter.subtract(enShift); 681 681 682 if (!newCenter.equals(getCenter()) || !Utils.equalsEpsilon(getScale(), newScale)) { 682 EastNorth oldCenter = getCenter(); 683 if (!newCenter.equals(oldCenter) || !Utils.equalsEpsilon(getScale(), newScale)) { 683 684 if (!initial) { 684 pushZoomUndo( getCenter(), getScale());685 pushZoomUndo(oldCenter, getScale()); 685 686 } 686 687 zoomNoUndoTo(newCenter, newScale, initial); … … 741 742 final int fps = 20; // animation frames per second 742 743 final int speed = 1500; // milliseconds for full-screen-width pan 743 if (!newCenter.equals(getCenter())) {744 final EastNorth oldCenter = getCenter();744 final EastNorth oldCenter = getCenter(); 745 if (!newCenter.equals(oldCenter)) { 745 746 final double distance = newCenter.distance(oldCenter) / getScale(); 746 747 final double milliseconds = distance / getWidth() * speed;
Note:
See TracChangeset
for help on using the changeset viewer.