From 49c17d6fd1ed9e4190009e0215070fb69518c825 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Fri, 15 Dec 2023 17:05:00 +0100 Subject: [PATCH] Simplify eachTilelayer method Having a custom layer also in the predefined layers list is a edge case we can deal with. --- umap/static/umap/js/umap.js | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index ca123317..159328ee 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -646,16 +646,9 @@ L.U.Map.include({ this.setOverlay() }, - eachTileLayer: function (method, context) { - const urls = [] - const call = (layer) => { - const url = layer.options.url_template - if (urls.indexOf(url) !== -1) return - method.call(context, layer) - urls.push(url) - } - if (this.customTilelayer) call(this.customTilelayer) - this.tilelayers.forEach(call) + eachTileLayer: function (callback, context) { + if (this.customTilelayer) callback.call(context, this.customTilelayer) + this.tilelayers.forEach((layer) => callback.call(context, layer)) }, setOverlay: function () {