only draw the layer when it needs to be drawn
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1625 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -281,20 +281,19 @@ OpenLayers.Map.prototype = {
|
|||||||
this.layers.push(layer);
|
this.layers.push(layer);
|
||||||
layer.setMap(this);
|
layer.setMap(this);
|
||||||
|
|
||||||
//make sure layer draws itself!
|
if (layer.isBaseLayer) {
|
||||||
if (this.center != null) {
|
|
||||||
var bounds = this.getExtent();
|
|
||||||
layer.moveTo(bounds, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (layer.isBaseLayer) {
|
|
||||||
// set the first baselaye we add as the baselayer
|
|
||||||
if (this.baseLayer == null) {
|
if (this.baseLayer == null) {
|
||||||
|
// set the first baselaye we add as the baselayer
|
||||||
this.setBaseLayer(layer);
|
this.setBaseLayer(layer);
|
||||||
this.events.triggerEvent("changebaselayer");
|
this.events.triggerEvent("changebaselayer");
|
||||||
} else {
|
} else {
|
||||||
layer.setVisibility(false);
|
layer.setVisibility(false);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
var extent = this.getExtent();
|
||||||
|
if (extent) {
|
||||||
|
layer.moveTo(extent, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.events.triggerEvent("addlayer");
|
this.events.triggerEvent("addlayer");
|
||||||
|
|||||||
Reference in New Issue
Block a user