Don't let wrapDateLine maps be wider than one world width.
This commit is contained in:
@@ -1701,6 +1701,30 @@ OpenLayers.Map = OpenLayers.Class({
|
||||
this.events.triggerEvent("move");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: adjustZoom
|
||||
*
|
||||
* Parameters:
|
||||
* zoom - {Number} The zoom level to adjust
|
||||
*
|
||||
* Returns:
|
||||
* {Integer} Adjusted zoom level that shows a map not wider than its
|
||||
* <baseLayer>'s maxExtent.
|
||||
*/
|
||||
adjustZoom: function(zoom) {
|
||||
var resolution, resolutions = this.baseLayer.resolutions,
|
||||
maxResolution = this.getMaxExtent().getWidth() / this.getSize().w;
|
||||
if (this.getResolutionForZoom(zoom) > maxResolution) {
|
||||
for (var i=zoom|0, ii=resolutions.length; i<ii; ++i) {
|
||||
if (resolutions[i] <= maxResolution) {
|
||||
zoom = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return zoom;
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: moveTo
|
||||
@@ -1723,6 +1747,9 @@ OpenLayers.Map = OpenLayers.Class({
|
||||
zoom = Math.round(zoom);
|
||||
}
|
||||
}
|
||||
if (this.baseLayer.wrapDateLine) {
|
||||
zoom = this.adjustZoom(zoom);
|
||||
}
|
||||
// dragging is false by default
|
||||
var dragging = options.dragging || this.dragging;
|
||||
// forceZoomChange is false by default
|
||||
|
||||
Reference in New Issue
Block a user