From 7ba704305a6952a46bcea673fdca2c73e0ecc917 Mon Sep 17 00:00:00 2001 From: euzuro Date: Thu, 5 Oct 2006 20:56:40 +0000 Subject: [PATCH] make setVisibility() actually call display(). also add some comments on this rather funky situation. git-svn-id: http://svn.openlayers.org/trunk/openlayers@1615 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Layer.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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) {