Skip to content

Commit

Permalink
boot.js: fix layerChooser.getLayers
Browse files Browse the repository at this point in the history
`layerId` meant to be number
(there was unintended change during adaptation to leaflet 1)
  • Loading branch information
johndoe committed Jul 30, 2019
1 parent a618a5c commit 6892df2
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions code/boot.js
Expand Up @@ -498,14 +498,12 @@ window.setupLayerChooserApi = function() {
//hook some additional code into the LayerControl so it's easy for the mobile app to interface with it
//WARNING: does depend on internals of the L.Control.Layers code
window.layerChooser.getLayers = function() {
var baseLayers = new Array();
var overlayLayers = new Array();

for (i in this._layers) {
var obj = this._layers[i];
var baseLayers = [];
var overlayLayers = [];
this._layers.forEach(function (obj,idx) {
var layerActive = window.map.hasLayer(obj.layer);
var info = {
layerId: i,
layerId: idx,
name: obj.name,
active: layerActive
}
Expand All @@ -514,7 +512,7 @@ window.setupLayerChooserApi = function() {
} else {
baseLayers.push(info);
}
}
});

var overlayLayersJSON = JSON.stringify(overlayLayers);
var baseLayersJSON = JSON.stringify(baseLayers);
Expand Down

0 comments on commit 6892df2

Please sign in to comment.