Merge remote-tracking branch 'upstream/pull/5573'
This commit is contained in:
commit
a6622e7d2c
1 changed files with 8 additions and 9 deletions
|
@ -115,19 +115,18 @@ L.OSM.Map = L.Map.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
updateLayers: function (layerParam) {
|
updateLayers: function (layerParam) {
|
||||||
var layers = layerParam || "M";
|
const oldBaseLayer = this.getMapBaseLayer();
|
||||||
|
let newBaseLayer;
|
||||||
|
|
||||||
for (let i = this.baseLayers.length - 1; i >= 0; i--) {
|
for (const layer of this.baseLayers) {
|
||||||
if (layers.indexOf(this.baseLayers[i].options.code) === -1) {
|
if (!newBaseLayer || layerParam.includes(layer.options.code)) {
|
||||||
this.removeLayer(this.baseLayers[i]);
|
newBaseLayer = layer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = this.baseLayers.length - 1; i >= 0; i--) {
|
if (newBaseLayer !== oldBaseLayer) {
|
||||||
if (layers.indexOf(this.baseLayers[i].options.code) >= 0 || i === 0) {
|
if (oldBaseLayer) this.removeLayer(oldBaseLayer);
|
||||||
this.addLayer(this.baseLayers[i]);
|
if (newBaseLayer) this.addLayer(newBaseLayer);
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue