always start the map extent on the right of the dateline
This commit is contained in:
@@ -1940,7 +1940,18 @@ OpenLayers.Map = OpenLayers.Class({
|
||||
var valid = false;
|
||||
if (lonlat != null) {
|
||||
var maxExtent = this.getMaxExtent();
|
||||
valid = maxExtent.containsLonLat(lonlat);
|
||||
valid = maxExtent.containsLonLat(lonlat);
|
||||
if (!valid && this.baseLayer.wrapDateLine) {
|
||||
lonlat = lonlat.clone();
|
||||
var worldWidth = maxExtent.getWidth();
|
||||
while(lonlat.lon > maxExtent.right) {
|
||||
lonlat.lon -= worldWidth;
|
||||
valid = maxExtent.containsLonLat(lonlat);
|
||||
if (valid) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return valid;
|
||||
},
|
||||
@@ -2254,12 +2265,9 @@ OpenLayers.Map = OpenLayers.Class({
|
||||
}
|
||||
//if the bounds was straddling (see above), then the center point
|
||||
// we got from it was wrong. So we take our new bounds and ask it
|
||||
// for the center. Because our new bounds is at least partially
|
||||
// outside the bounds of maxExtent, the new calculated center
|
||||
// might also be. We don't want to pass a bad center value to
|
||||
// setCenter, so we have it wrap itself across the date line.
|
||||
// for the center.
|
||||
//
|
||||
center = bounds.getCenterLonLat().wrapDateLine(maxExtent);
|
||||
center = bounds.getCenterLonLat();
|
||||
}
|
||||
this.setCenter(center, this.getZoomForExtent(bounds, closest));
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user