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) {
|
eachTileLayer: function (method, context) {
|
||||||
const urls = []
|
const urls = []
|
||||||
for (const i in this.tilelayers) {
|
const call = (layer) => {
|
||||||
if (this.tilelayers.hasOwnProperty(i)) {
|
const url = layer.options.url_template
|
||||||
method.call(context, this.tilelayers[i])
|
if (urls.indexOf(url) !== -1) return
|
||||||
urls.push(this.tilelayers[i]._url)
|
method.call(context, layer)
|
||||||
}
|
urls.push(url)
|
||||||
}
|
|
||||||
if (
|
|
||||||
this.customTilelayer &&
|
|
||||||
Array.prototype.indexOf &&
|
|
||||||
urls.indexOf(this.customTilelayer._url) === -1
|
|
||||||
) {
|
|
||||||
method.call(context || this, this.customTilelayer)
|
|
||||||
}
|
}
|
||||||
|
if (this.customTilelayer) call(this.customTilelayer)
|
||||||
|
this.tilelayers.forEach(call)
|
||||||
},
|
},
|
||||||
|
|
||||||
setOverlay: function () {
|
setOverlay: function () {
|
||||||
|
|
Loading…
Reference in a new issue