diff --git a/lib/OpenLayers/Layer.js b/lib/OpenLayers/Layer.js index 9120c1a888..e405cc4509 100644 --- a/lib/OpenLayers/Layer.js +++ b/lib/OpenLayers/Layer.js @@ -236,7 +236,15 @@ OpenLayers.Layer.prototype = { return this.visibility; }, - /** + /** Set the visibility flag for the layer and hide/show&redraw accordingly. + * Fire event unless otherwise specified + * + * Note that visibility is no longer simply whether or not the layer's + * style.display is set to "block". Now we store a 'visibility' state + * property on the layer class, this allows us to remember whether or not + * we *desire* for a layer to be visible. In the case where the map's + * resolution is out of the layer's range, this desire may be subverted. + * * @param {Boolean} visible Whether or not to display the layer * (if in range) * @param {Boolean} noEvent @@ -244,6 +252,7 @@ OpenLayers.Layer.prototype = { setVisibility: function(visibility, noEvent) { if (visibility != this.visibility) { this.visibility = visibility; + this.display(visibility); if (this.map != null) { var extent = this.map.getExtent(); if (extent != null) { @@ -257,7 +266,8 @@ OpenLayers.Layer.prototype = { } }, - /** + /** Hide or show the Layer + * * @param {Boolean} display */ display: function(display) {