From 99ea5db0277b7273281de00a8edae26811b99571 Mon Sep 17 00:00:00 2001 From: euzuro Date: Fri, 6 Oct 2006 02:16:40 +0000 Subject: [PATCH] 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 --- lib/OpenLayers/Map.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/OpenLayers/Map.js b/lib/OpenLayers/Map.js index 810f75aca9..4c31590236 100644 --- a/lib/OpenLayers/Map.js +++ b/lib/OpenLayers/Map.js @@ -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");