Make sure custom tilelayer is displayed first, if any
This commit is contained in:
parent
afd57d6806
commit
34d3beef25
1 changed files with 7 additions and 12 deletions
|
@ -648,19 +648,14 @@ L.U.Map.include({
|
|||
|
||||
eachTileLayer: function (method, context) {
|
||||
const urls = []
|
||||
for (const i in this.tilelayers) {
|
||||
if (this.tilelayers.hasOwnProperty(i)) {
|
||||
method.call(context, this.tilelayers[i])
|
||||
urls.push(this.tilelayers[i]._url)
|
||||
}
|
||||
}
|
||||
if (
|
||||
this.customTilelayer &&
|
||||
Array.prototype.indexOf &&
|
||||
urls.indexOf(this.customTilelayer._url) === -1
|
||||
) {
|
||||
method.call(context || this, this.customTilelayer)
|
||||
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)
|
||||
},
|
||||
|
||||
setOverlay: function () {
|
||||
|
|
Loading…
Reference in a new issue