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:
euzuro
2006-10-06 02:16:40 +00:00
parent fbd82a300b
commit 99ea5db027

View File

@@ -281,20 +281,19 @@ OpenLayers.Map.prototype = {
this.layers.push(layer);
layer.setMap(this);
//make sure layer draws itself!
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 (layer.isBaseLayer) {
if (this.baseLayer == null) {
// set the first baselaye we add as the baselayer
this.setBaseLayer(layer);
this.events.triggerEvent("changebaselayer");
} else {
layer.setVisibility(false);
}
} else {
var extent = this.getExtent();
if (extent) {
layer.moveTo(extent, true);
}
}
this.events.triggerEvent("addlayer");