Allow use of array for bounds.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user