Ensuring that setVisibility is called during setBaseLayer for layers where visibility is true. (With allOverlays true, a layer doesn't have to be visible to beocome the base layer - twisted huh?) r=ahocevar (closes #2290)
git-svn-id: http://svn.openlayers.org/trunk/openlayers@10023 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -1122,7 +1122,7 @@ 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) {
|
if(!this.allOverlays || this.baseLayer.visibility) {
|
||||||
this.baseLayer.setVisibility(true);
|
this.baseLayer.setVisibility(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+20
-1
@@ -1225,7 +1225,7 @@
|
|||||||
|
|
||||||
function test_allOverlays(t) {
|
function test_allOverlays(t) {
|
||||||
|
|
||||||
t.plan(16);
|
t.plan(17);
|
||||||
|
|
||||||
var map = new OpenLayers.Map({
|
var map = new OpenLayers.Map({
|
||||||
div: "map", allOverlays: true
|
div: "map", allOverlays: true
|
||||||
@@ -1309,6 +1309,25 @@
|
|||||||
|
|
||||||
map.destroy();
|
map.destroy();
|
||||||
|
|
||||||
|
// make sure setVisibility is called when adding a single layer to the map
|
||||||
|
map = new OpenLayers.Map({
|
||||||
|
div: "map", allOverlays: true
|
||||||
|
});
|
||||||
|
var count = 0;
|
||||||
|
var layer = new OpenLayers.Layer(null, {
|
||||||
|
visibility: true,
|
||||||
|
setVisibility: function() {
|
||||||
|
++count;
|
||||||
|
OpenLayers.Layer.prototype.setVisibility.apply(this, arguments);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
map.addLayer(layer);
|
||||||
|
map.zoomToMaxExtent();
|
||||||
|
|
||||||
|
t.eq(count, 1, "setVisibility called when visibility is true in layer config");
|
||||||
|
|
||||||
|
map.destroy();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_panTo(t) {
|
function test_panTo(t) {
|
||||||
|
|||||||
Reference in New Issue
Block a user