From ca0c8c421e6b2671fa8c3313dd3adad065132dd9 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Sun, 4 Nov 2018 21:05:21 +0100 Subject: [PATCH] Show each visible layer in the caption Not only the browsable ones (eg. we want to have a heatmap in there) --- umap/static/umap/js/umap.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index 5f82b885..44a212c7 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -862,7 +862,7 @@ L.U.Map.include({ description.innerHTML = L.Util.toHTML(this.options.description); } var datalayerContainer = L.DomUtil.create('div', 'datalayer-container', container); - this.eachBrowsableDataLayer(function (datalayer) { + this.eachVisibleDataLayer(function (datalayer) { var p = L.DomUtil.create('p', '', datalayerContainer), color = L.DomUtil.create('span', 'datalayer-color', 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(); }); }, + eachVisibleDataLayer: function (method, context) { + this.eachDataLayerReverse(method, context, function (d) { return d.isVisible(); }); + }, + findDataLayer: function (method, context) { for (var i = this.datalayers_index.length - 1; i >= 0; i--) { if (method.call(context, this.datalayers_index[i])) return this.datalayers_index[i];