Simplify eachTilelayer method

Having a custom layer also in the predefined layers list is a
edge case we can deal with.
This commit is contained in:
Yohan Boniface 2023-12-15 17:05:00 +01:00
parent b6b6139c79
commit 49c17d6fd1

View file

@ -646,16 +646,9 @@ L.U.Map.include({
this.setOverlay() this.setOverlay()
}, },
eachTileLayer: function (method, context) { eachTileLayer: function (callback, context) {
const urls = [] if (this.customTilelayer) callback.call(context, this.customTilelayer)
const call = (layer) => { this.tilelayers.forEach((layer) => callback.call(context, 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)
}, },
setOverlay: function () { setOverlay: function () {