Show each visible layer in the caption

Not only the browsable ones (eg. we want to have a heatmap in there)
This commit is contained in:
Yohan Boniface 2018-11-04 21:05:21 +01:00
parent bdbaef123c
commit ca0c8c421e

View file

@ -862,7 +862,7 @@ L.U.Map.include({
description.innerHTML = L.Util.toHTML(this.options.description); description.innerHTML = L.Util.toHTML(this.options.description);
} }
var datalayerContainer = L.DomUtil.create('div', 'datalayer-container', container); var datalayerContainer = L.DomUtil.create('div', 'datalayer-container', container);
this.eachBrowsableDataLayer(function (datalayer) { this.eachVisibleDataLayer(function (datalayer) {
var p = L.DomUtil.create('p', '', datalayerContainer), var p = L.DomUtil.create('p', '', datalayerContainer),
color = L.DomUtil.create('span', 'datalayer-color', p), color = L.DomUtil.create('span', 'datalayer-color', p),
headline = L.DomUtil.create('strong', '', p), headline = L.DomUtil.create('strong', '', p),
@ -926,10 +926,14 @@ L.U.Map.include({
} }
}, },
eachBrowsableDataLayer: function (method, context, filter) { eachBrowsableDataLayer: function (method, context) {
this.eachDataLayerReverse(method, context, function (d) { return d.allowBrowse(); }); this.eachDataLayerReverse(method, context, function (d) { return d.allowBrowse(); });
}, },
eachVisibleDataLayer: function (method, context) {
this.eachDataLayerReverse(method, context, function (d) { return d.isVisible(); });
},
findDataLayer: function (method, context) { findDataLayer: function (method, context) {
for (var i = this.datalayers_index.length - 1; i >= 0; i--) { for (var i = this.datalayers_index.length - 1; i >= 0; i--) {
if (method.call(context, this.datalayers_index[i])) return this.datalayers_index[i]; if (method.call(context, this.datalayers_index[i])) return this.datalayers_index[i];