also check for visibility of the layer in the central place: the update function

This commit is contained in:
Bart van den Eijnden
2012-05-15 12:26:21 +02:00
parent bca3e45940
commit 44f9b81085
+3 -12
View File
@@ -81,20 +81,11 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, {
if(activated) { if(activated) {
this.layer.events.on({ this.layer.events.on({
"moveend": this.update, "moveend": this.update,
scope: this
});
this.layer.events.on({
"refresh": this.update, "refresh": this.update,
"visibilitychanged": this.update,
scope: this scope: this
}); });
if(this.layer.visibility === true) { this.update();
this.update();
} else {
this.layer.events.on({
"visibilitychanged": this.update,
scope: this
});
}
} }
return activated; return activated;
}, },
@@ -134,7 +125,7 @@ OpenLayers.Strategy.BBOX = OpenLayers.Class(OpenLayers.Strategy, {
update: function(options) { update: function(options) {
var mapBounds = this.getMapBounds(); var mapBounds = this.getMapBounds();
if (mapBounds !== null && ((options && options.force) || 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.calculateBounds(mapBounds);
this.resolution = this.layer.map.getResolution(); this.resolution = this.layer.map.getResolution();
this.triggerRead(options); this.triggerRead(options);