Merge pull request #1298 from umap-project/fix-remotelayer-with-zoom-onload
Try to fix remote datalayer not sending dataloaded
This commit is contained in:
commit
aa1b04b3ad
2 changed files with 13 additions and 7 deletions
|
@ -406,12 +406,19 @@ L.U.Map.include({
|
|||
if (dataToload === 0) dataLoaded()
|
||||
}
|
||||
this.eachDataLayer(function (datalayer) {
|
||||
if (force && !datalayer.hasDataLoaded()) datalayer.show()
|
||||
if (datalayer.showAtLoad() || force) datalayer.onceLoaded(decrementToLoad)
|
||||
else decrementToLoad()
|
||||
if (datalayer.showAtLoad() || force)
|
||||
if (force && !datalayer.hasDataLoaded()) {
|
||||
datalayer.show()
|
||||
}
|
||||
if (datalayer.showAtLoad() || force) {
|
||||
datalayer.onceLoaded(decrementToLoad)
|
||||
} else {
|
||||
decrementToLoad()
|
||||
}
|
||||
if (datalayer.showAtLoad() || force) {
|
||||
datalayer.onceDataLoaded(decrementDataToLoad)
|
||||
else decrementDataToLoad()
|
||||
} else {
|
||||
decrementDataToLoad({ sourceTarget: datalayer })
|
||||
}
|
||||
})
|
||||
if (total === 0) {
|
||||
// no datalayer
|
||||
|
|
|
@ -274,7 +274,7 @@ L.U.DataLayer = L.Evented.extend({
|
|||
},
|
||||
|
||||
onMoveEnd: function (e) {
|
||||
if (this.isRemoteLayer()) this.fetchRemoteData()
|
||||
if (this.isRemoteLayer() && this.showAtZoom()) this.fetchRemoteData()
|
||||
},
|
||||
|
||||
onZoomEnd: function (e) {
|
||||
|
@ -409,7 +409,6 @@ L.U.DataLayer = L.Evented.extend({
|
|||
|
||||
fetchRemoteData: function (force) {
|
||||
if (!this.isRemoteLayer()) return
|
||||
if (!this.showAtZoom()) return
|
||||
if (!this.options.remoteData.dynamic && this.hasDataLoaded() && !force) return
|
||||
if (!this.isVisible()) return
|
||||
let url = this.map.localizeUrl(this.options.remoteData.url)
|
||||
|
|
Loading…
Reference in a new issue