Making map construction work with permalink.
If a map is configured with a permalink control and a center, the permalink control tries to work with the map center before setCenter is called. This sequence assumes that the map center will already be a LonLat. This fails if the map is constructed with a coordinate array. Safer move is to convert center to LonLat before controls are added.
This commit is contained in:
@@ -496,13 +496,16 @@ OpenLayers.Map = OpenLayers.Class({
|
||||
this.projection.projCode : this.projection;
|
||||
OpenLayers.Util.applyDefaults(this, OpenLayers.Projection.defaults[projCode]);
|
||||
|
||||
// allow extents to be arrays
|
||||
// allow extents and center 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);
|
||||
}
|
||||
if (this.center && !(this.center instanceof OpenLayers.LonLat)) {
|
||||
this.center = new OpenLayers.LonLat(this.center);
|
||||
}
|
||||
|
||||
// initialize layers array
|
||||
this.layers = [];
|
||||
|
||||
Reference in New Issue
Block a user