add a 'changelayer' event that fires when a layer's visibility changes. listen for this in the layerswitcher
git-svn-id: http://svn.openlayers.org/trunk/openlayers@1050 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -168,11 +168,16 @@ OpenLayers.Layer.prototype = {
|
||||
* @param {bool} visible
|
||||
*/
|
||||
setVisibility: function(visible) {
|
||||
this.div.style.display = (visible) ? "block" : "none";
|
||||
if ((visible) && (this.map != null)) {
|
||||
var extent = this.map.getExtent();
|
||||
if (extent != null) {
|
||||
this.moveTo(this.map.getExtent());
|
||||
if (visible != this.getVisibility()) {
|
||||
this.div.style.display = (visible) ? "block" : "none";
|
||||
if (this.map != null) {
|
||||
if (visible) {
|
||||
var extent = this.map.getExtent();
|
||||
if (extent != null) {
|
||||
this.moveTo(this.map.getExtent());
|
||||
}
|
||||
}
|
||||
this.map.events.triggerEvent("changelayer");
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user