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 =
|
OpenLayers.Control.LayerSwitcher.prototype =
|
||||||
Object.extend( new OpenLayers.Control(), {
|
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
|
* @constructor
|
||||||
*/
|
*/
|
||||||
@@ -38,11 +46,11 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
|||||||
div.innerHTML = this.map.layers[i].name;
|
div.innerHTML = this.map.layers[i].name;
|
||||||
var status = this.map.layers[i].getVisibility();
|
var status = this.map.layers[i].getVisibility();
|
||||||
if (!status) {
|
if (!status) {
|
||||||
div.style.backgroundColor = "black";
|
div.style.backgroundColor = this.NONACTIVE_COLOR;
|
||||||
div.style.color = "white";
|
div.style.color = this.ACTIVE_COLOR;
|
||||||
} else {
|
} else {
|
||||||
div.style.backgroundColor = "white";
|
div.style.backgroundColor = this.ACTIVE_COLOR;
|
||||||
div.style.color = "black";
|
div.style.color = this.NONACTIVE_COLOR;
|
||||||
}
|
}
|
||||||
div.style.padding = "5px";
|
div.style.padding = "5px";
|
||||||
div.layerid = i;
|
div.layerid = i;
|
||||||
@@ -63,11 +71,11 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
|||||||
var status = this.map.layers[this.layerid].getVisibility();
|
var status = this.map.layers[this.layerid].getVisibility();
|
||||||
this.map.layers[this.layerid].setVisibility(!status);
|
this.map.layers[this.layerid].setVisibility(!status);
|
||||||
if (status) {
|
if (status) {
|
||||||
this.style.backgroundColor = "black";
|
this.style.backgroundColor = this.NONACTIVE_COLOR;
|
||||||
this.style.color = "white";
|
this.style.color = this.ACTIVE_COLOR;
|
||||||
} else {
|
} else {
|
||||||
this.style.backgroundColor = "white";
|
this.style.backgroundColor = this.ACTIVE_COLOR;
|
||||||
this.style.color = "black";
|
this.style.color = this.NONACTIVE_COLOR;
|
||||||
}
|
}
|
||||||
Event.stop(evt);
|
Event.stop(evt);
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user