Prevent computing choropleth breaks for each feature when importing

When importing a choropleth layer, the layer does not have a umap_id,
thus "hasDataLoaded" is immediately true, instead of being true when
all the "known" data is imported.

At this point, I can't find a good reason to keep the check on umap_id,
so let's remove and move forward.
This commit is contained in:
Yohan Boniface 2023-10-12 10:07:51 +02:00
parent 7318ebd2f9
commit 8fdddddc9e

View file

@ -135,7 +135,10 @@ L.U.Layer.Choropleth = L.FeatureGroup.extend({
[], [],
this.datalayer.options.choropleth this.datalayer.options.choropleth
) )
this.datalayer.onceDataLoaded(() => {
this.redraw()
this.datalayer.on('datachanged', this.redraw, this) this.datalayer.on('datachanged', this.redraw, this)
})
}, },
redraw: function () { redraw: function () {
@ -717,7 +720,7 @@ L.U.DataLayer = L.Evented.extend({
}, },
hasDataLoaded: function () { hasDataLoaded: function () {
return !this.umap_id || this._dataloaded return this._dataloaded
}, },
setUmapId: function (id) { setUmapId: function (id) {