add constants for active/deactive switcher controls
git-svn-id: http://svn.openlayers.org/trunk/openlayers@75 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -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);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user