diff --git a/lib/OpenLayers/BaseTypes/Bounds.js b/lib/OpenLayers/BaseTypes/Bounds.js index 5935ccbe1a..9eefcc1831 100644 --- a/lib/OpenLayers/BaseTypes/Bounds.js +++ b/lib/OpenLayers/BaseTypes/Bounds.js @@ -67,6 +67,12 @@ OpenLayers.Bounds = OpenLayers.Class({ * top - {Number} The top bounds. */ initialize: function(left, bottom, right, top) { + if (OpenLayers.Util.isArray(left)) { + top = left[3]; + right = left[2]; + bottom = left[1]; + left = left[0]; + } if (left != null) { this.left = OpenLayers.Util.toFloat(left); } diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 90ead46cd4..33daa3a66c 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -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(); diff --git a/tests/BaseTypes/Bounds.html b/tests/BaseTypes/Bounds.html index b436005d1c..b8ff57eceb 100644 --- a/tests/BaseTypes/Bounds.html +++ b/tests/BaseTypes/Bounds.html @@ -4,7 +4,7 @@