Changeset 6873 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2014-02-19T00:30:40+01:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/NavigatableComponent.java
r6509 r6873 416 416 int width = getWidth()/2; 417 417 int height = getHeight()/2; 418 if (width == 0 || height == 0) {419 throw new IllegalStateException("Cannot zoom into undimensioned NavigatableComponent");420 }421 418 LatLon l1 = new LatLon(b.getMinLat(), lon); 422 419 LatLon l2 = new LatLon(b.getMaxLat(), lon); … … 424 421 EastNorth e2 = getProjection().latlon2eastNorth(l2); 425 422 double d = e2.north() - e1.north(); 426 if(d < height*newScale) 427 { 423 if (height > 0 && d < height*newScale) { 428 424 double newScaleH = d/height; 429 425 e1 = getProjection().latlon2eastNorth(new LatLon(lat, b.getMinLon())); 430 426 e2 = getProjection().latlon2eastNorth(new LatLon(lat, b.getMaxLon())); 431 427 d = e2.east() - e1.east(); 432 if (d < width*newScale) {428 if (width > 0 && d < width*newScale) { 433 429 newScale = Math.max(newScaleH, d/width); 434 430 } 435 } 436 else 437 { 431 } else if (height > 0) { 438 432 d = d/(l1.greatCircleDistance(l2)*height*10); 439 if (newScale < d) {433 if (newScale < d) { 440 434 newScale = d; 441 435 }
Note:
See TracChangeset
for help on using the changeset viewer.