From e5914e6c509d9eeb3b46d393e3aa11a449508b97 Mon Sep 17 00:00:00 2001 From: euzuro Date: Wed, 17 May 2006 02:16:57 +0000 Subject: [PATCH] add constants for active/deactive switcher controls git-svn-id: http://svn.openlayers.org/trunk/openlayers@75 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Control/LayerSwitcher.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/OpenLayers/Control/LayerSwitcher.js b/lib/OpenLayers/Control/LayerSwitcher.js index 77641dfd57..3c215bfa44 100644 --- a/lib/OpenLayers/Control/LayerSwitcher.js +++ b/lib/OpenLayers/Control/LayerSwitcher.js @@ -5,6 +5,14 @@ OpenLayers.Control.LayerSwitcher = Class.create(); OpenLayers.Control.LayerSwitcher.prototype = Object.extend( new OpenLayers.Control(), { + /** color used in the UI to show a layer is active/displayed + * @type String */ + ACTIVE_COLOR: "darkblue", + + /** color used in the UI to show a layer is deactivated/hidden + * @type String */ + NONACTIVE_COLOR: "lightblue", + /** * @constructor */ @@ -38,11 +46,11 @@ OpenLayers.Control.LayerSwitcher.prototype = div.innerHTML = this.map.layers[i].name; var status = this.map.layers[i].getVisibility(); if (!status) { - div.style.backgroundColor = "black"; - div.style.color = "white"; + div.style.backgroundColor = this.NONACTIVE_COLOR; + div.style.color = this.ACTIVE_COLOR; } else { - div.style.backgroundColor = "white"; - div.style.color = "black"; + div.style.backgroundColor = this.ACTIVE_COLOR; + div.style.color = this.NONACTIVE_COLOR; } div.style.padding = "5px"; div.layerid = i; @@ -63,11 +71,11 @@ OpenLayers.Control.LayerSwitcher.prototype = var status = this.map.layers[this.layerid].getVisibility(); this.map.layers[this.layerid].setVisibility(!status); if (status) { - this.style.backgroundColor = "black"; - this.style.color = "white"; + this.style.backgroundColor = this.NONACTIVE_COLOR; + this.style.color = this.ACTIVE_COLOR; } else { - this.style.backgroundColor = "white"; - this.style.color = "black"; + this.style.backgroundColor = this.ACTIVE_COLOR; + this.style.color = this.NONACTIVE_COLOR; } Event.stop(evt); },