Take care not to change layer visibility when changing layer draw order (allOverlays only). r=ahocevar (closes #2004)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@9216 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -1098,7 +1098,7 @@ OpenLayers.Map = OpenLayers.Class({
|
|||||||
if (OpenLayers.Util.indexOf(this.layers, newBaseLayer) != -1) {
|
if (OpenLayers.Util.indexOf(this.layers, newBaseLayer) != -1) {
|
||||||
|
|
||||||
// make the old base layer invisible
|
// make the old base layer invisible
|
||||||
if (this.baseLayer != null) {
|
if (this.baseLayer != null && !this.allOverlays) {
|
||||||
this.baseLayer.setVisibility(false);
|
this.baseLayer.setVisibility(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1109,7 +1109,9 @@ OpenLayers.Map = OpenLayers.Class({
|
|||||||
// changing. This is used by tiles to check if they should
|
// changing. This is used by tiles to check if they should
|
||||||
// draw themselves.
|
// draw themselves.
|
||||||
this.viewRequestID++;
|
this.viewRequestID++;
|
||||||
|
if(!this.allOverlays) {
|
||||||
this.baseLayer.visibility = true;
|
this.baseLayer.visibility = true;
|
||||||
|
}
|
||||||
|
|
||||||
//redraw all layers
|
//redraw all layers
|
||||||
var center = this.getCenter();
|
var center = this.getCenter();
|
||||||
|
|||||||
@@ -1208,7 +1208,7 @@
|
|||||||
|
|
||||||
function test_allOverlays(t) {
|
function test_allOverlays(t) {
|
||||||
|
|
||||||
t.plan(9);
|
t.plan(14);
|
||||||
|
|
||||||
var map = new OpenLayers.Map({
|
var map = new OpenLayers.Map({
|
||||||
div: "map", allOverlays: true
|
div: "map", allOverlays: true
|
||||||
@@ -1264,8 +1264,20 @@
|
|||||||
t.eq(map.baseLayer.name, "b", "raising the base layer sets a new base layer");
|
t.eq(map.baseLayer.name, "b", "raising the base layer sets a new base layer");
|
||||||
|
|
||||||
map.raiseLayer(d, -1);
|
map.raiseLayer(d, -1);
|
||||||
|
// d, b, c, a
|
||||||
t.eq(map.baseLayer.name, "d", "lowering a layer to lowest index sets as base");
|
t.eq(map.baseLayer.name, "d", "lowering a layer to lowest index sets as base");
|
||||||
|
|
||||||
|
// all this switching of base layer didn't muck with layer visibility
|
||||||
|
t.eq(a.visibility, true, "a is visible");
|
||||||
|
t.eq(b.visibility, true, "b is visible");
|
||||||
|
t.eq(c.visibility, true, "c is visible");
|
||||||
|
t.eq(d.visibility, true, "d is visible");
|
||||||
|
|
||||||
|
// test that map can have an invisible base layer
|
||||||
|
b.setVisibility(false);
|
||||||
|
map.setLayerIndex(b, 0);
|
||||||
|
t.eq(b.visibility, false, "changing layer order doesn't change visibility");
|
||||||
|
|
||||||
map.destroy();
|
map.destroy();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user