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()
},
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 () {