if there are no overlays then don't display the overlay label
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1116 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -93,10 +93,16 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
this.dataLayersDiv.innerHTML = "";
|
||||
this.dataLayerInputs = new Array();
|
||||
|
||||
var containsOverlays = false;
|
||||
|
||||
for( var i = 0; i < this.map.layers.length; i++) {
|
||||
var layer = this.map.layers[i];
|
||||
var baseLayer = layer.isBaseLayer;
|
||||
|
||||
if (!baseLayer) {
|
||||
containsOverlays = true;
|
||||
}
|
||||
|
||||
// only check a baselayer if it is *the* baselayer, check data
|
||||
// layers if they are visible
|
||||
var checked = (baseLayer) ? (layer == this.map.baseLayer)
|
||||
@@ -136,6 +142,9 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
|
||||
}
|
||||
|
||||
// if no overlays, dont display the overlay label
|
||||
this.dataLbl.style.display = (containsOverlays) ? "" : "none";
|
||||
|
||||
return this.div;
|
||||
},
|
||||
|
||||
@@ -292,12 +301,12 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
||||
this.layersDiv.appendChild(this.baseLayersDiv);
|
||||
|
||||
|
||||
var dataLbl = document.createElement("div");
|
||||
dataLbl.innerHTML = "<u>Overlays</u>";
|
||||
dataLbl.style.marginTop = "3px";
|
||||
dataLbl.style.marginLeft = "3px";
|
||||
dataLbl.style.marginBottom = "3px";
|
||||
this.layersDiv.appendChild(dataLbl);
|
||||
this.dataLbl = document.createElement("div");
|
||||
this.dataLbl.innerHTML = "<u>Overlays</u>";
|
||||
this.dataLbl.style.marginTop = "3px";
|
||||
this.dataLbl.style.marginLeft = "3px";
|
||||
this.dataLbl.style.marginBottom = "3px";
|
||||
this.layersDiv.appendChild(this.dataLbl);
|
||||
|
||||
this.dataLayersDiv = document.createElement("div");
|
||||
this.dataLayersDiv.style.paddingLeft = "10px";
|
||||
|
||||
Reference in New Issue
Block a user