diff --git a/lib/OpenLayers/Strategy/BBOX.js b/lib/OpenLayers/Strategy/BBOX.js index a476b90cb8..6df04b1a03 100644 --- a/lib/OpenLayers/Strategy/BBOX.js +++ b/lib/OpenLayers/Strategy/BBOX.js @@ -81,20 +81,11 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, { if(activated) { this.layer.events.on({ "moveend": this.update, - scope: this - }); - this.layer.events.on({ "refresh": this.update, + "visibilitychanged": this.update, scope: this }); - if(this.layer.visibility === true) { - this.update(); - } else { - this.layer.events.on({ - "visibilitychanged": this.update, - scope: this - }); - } + this.update(); } return activated; }, @@ -134,7 +125,7 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, { update: function(options) { var mapBounds = this.getMapBounds(); if (mapBounds !== null && ((options && options.force) || - (this.layer.calculateInRange() && this.invalidBounds(mapBounds)))) { + (this.layer.visibility && this.layer.calculateInRange() && this.invalidBounds(mapBounds)))) { this.calculateBounds(mapBounds); this.resolution = this.layer.map.getResolution(); this.triggerRead(options);