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:
parent
b6b6139c79
commit
49c17d6fd1
1 changed files with 3 additions and 10 deletions
|
@ -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 () {
|
||||||
|
|
Loading…
Reference in a new issue