added member variables for activeColor and nonActiveColor so that users can customize dynamically
git-svn-id: http://svn.openlayers.org/trunk/openlayers@132 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -21,6 +21,12 @@ OpenLayers.Control.LayerSwitcher.NONACTIVE_COLOR = "lightblue";
|
|||||||
OpenLayers.Control.LayerSwitcher.prototype =
|
OpenLayers.Control.LayerSwitcher.prototype =
|
||||||
Object.extend( new OpenLayers.Control(), {
|
Object.extend( new OpenLayers.Control(), {
|
||||||
|
|
||||||
|
/** @type String */
|
||||||
|
activeColor: OpenLayers.Control.LayerSwitcher.ACTIVE_COLOR,
|
||||||
|
|
||||||
|
/** @type String */
|
||||||
|
nonActiveColor: OpenLayers.Control.LayerSwitcher.NONACTIVE_COLOR,
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @constructor
|
* @constructor
|
||||||
@@ -73,9 +79,12 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
|||||||
* @param {event} evt
|
* @param {event} evt
|
||||||
*/
|
*/
|
||||||
singleClick: function(evt) {
|
singleClick: function(evt) {
|
||||||
var visible = this.layer.getVisibility();
|
var div = Event.element(evt);
|
||||||
OpenLayers.Control.LayerSwitcher.setTabActivation(this, !visible);
|
var layer = div.layer;
|
||||||
this.layer.setVisibility(!visible);
|
var visible = layer.getVisibility();
|
||||||
|
|
||||||
|
this.setTabActivation(div, !visible);
|
||||||
|
layer.setVisibility(!visible);
|
||||||
Event.stop(evt);
|
Event.stop(evt);
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -113,10 +122,8 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
|||||||
backdropLabel.layer = layer;
|
backdropLabel.layer = layer;
|
||||||
|
|
||||||
// set event handlers
|
// set event handlers
|
||||||
backdropLabel.ondblclick =
|
backdropLabel.ondblclick = this.doubleClick.bindAsEventListener(this);
|
||||||
this.doubleClick.bindAsEventListener(backdropLabel);
|
backdropLabel.onmousedown = this.singleClick.bindAsEventListener(this);
|
||||||
backdropLabel.onmousedown =
|
|
||||||
this.singleClick.bindAsEventListener(backdropLabel);
|
|
||||||
|
|
||||||
|
|
||||||
// add label to div
|
// add label to div
|
||||||
@@ -130,26 +137,25 @@ OpenLayers.Control.LayerSwitcher.prototype =
|
|||||||
color: "white",
|
color: "white",
|
||||||
blend: false});
|
blend: false});
|
||||||
|
|
||||||
OpenLayers.Control.LayerSwitcher.setTabActivation(backdropLabel,
|
this.setTabActivation(backdropLabel, layer.getVisibility());
|
||||||
layer.getVisibility());
|
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @private
|
||||||
|
*
|
||||||
|
* @param {DOMElement} div
|
||||||
|
* @param {Boolean} activate
|
||||||
|
*/
|
||||||
|
setTabActivation:function(div, activate) {
|
||||||
|
var color = (activate) ? this.activeColor : this.nonActiveColor;
|
||||||
|
Rico.Corner.changeColor(div, color);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/** @final @type String */
|
/** @final @type String */
|
||||||
CLASS_NAME: "OpenLayers.Control.LayerSwitcher"
|
CLASS_NAME: "OpenLayers.Control.LayerSwitcher"
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
*
|
|
||||||
* @param {bool}
|
|
||||||
*/
|
|
||||||
OpenLayers.Control.LayerSwitcher.setTabActivation = function(div, activate) {
|
|
||||||
|
|
||||||
var color = (activate) ? OpenLayers.Control.LayerSwitcher.ACTIVE_COLOR
|
|
||||||
: OpenLayers.Control.LayerSwitcher.NONACTIVE_COLOR;
|
|
||||||
|
|
||||||
Rico.Corner.changeColor(div, color);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user