Making sure that new base layer becomes visible.

The new base layer may previously have been out of range, in which case setVisibility(true) would do nothing if the layer was visible already. So we check if it was previously out of range, and redraw it if necessary.
This commit is contained in:
ahocevar
2012-02-02 13:53:37 +01:00
parent aba04d7c42
commit abdd3a2e5b
2 changed files with 21 additions and 3 deletions

View File

@@ -1161,6 +1161,11 @@ OpenLayers.Map = OpenLayers.Class({
if(!this.allOverlays || this.baseLayer.visibility) {
this.baseLayer.setVisibility(true);
// Layer may previously have been visible but not in range.
// In this case we need to redraw it to make it visible.
if (this.baseLayer.inRange === false) {
this.baseLayer.redraw();
}
}
// recenter the map