Allow use of array for bounds.

This commit is contained in:
tschaub
2011-10-26 15:40:40 -06:00
parent 75a1a8e119
commit 98ee7167c4
4 changed files with 52 additions and 3 deletions

View File

@@ -478,6 +478,14 @@ OpenLayers.Map = OpenLayers.Class({
// now override default options
OpenLayers.Util.extend(this, options);
// allow extents to be arrays
if (this.maxExtent && !(this.maxExtent instanceof OpenLayers.Bounds)) {
this.maxExtent = new OpenLayers.Bounds(this.maxExtent);
}
if (this.restrictedExtent && !(this.restrictedExtent instanceof OpenLayers.Bounds)) {
this.restrictedExtent = new OpenLayers.Bounds(this.restrictedExtent);
}
// initialize layers array
this.layers = [];
@@ -2211,6 +2219,9 @@ OpenLayers.Map = OpenLayers.Class({
*
*/
zoomToExtent: function(bounds, closest) {
if (!(bounds instanceof OpenLayers.Bounds)) {
bounds = new OpenLayers.Bounds(bounds);
}
var center = bounds.getCenterLonLat();
if (this.baseLayer.wrapDateLine) {
var maxExtent = this.getMaxExtent();