Make sure filters are called before actually displaying a feature
on the map fix #1005
This commit is contained in:
parent
80e62f3046
commit
b013692527
1 changed files with 11 additions and 9 deletions
|
@ -312,13 +312,7 @@ L.U.DataLayer = L.Evented.extend({
|
||||||
if (visible) this.map.removeLayer(this.layer)
|
if (visible) this.map.removeLayer(this.layer)
|
||||||
const Class = L.U.Layer[this.options.type] || L.U.Layer.Default
|
const Class = L.U.Layer[this.options.type] || L.U.Layer.Default
|
||||||
this.layer = new Class(this)
|
this.layer = new Class(this)
|
||||||
const filterKeys = this.map.getFilterKeys(),
|
this.eachLayer((feature) => this.showFeature(feature))
|
||||||
filter = this.map.options.filter
|
|
||||||
this.eachLayer(function (layer) {
|
|
||||||
if (filter && !layer.matchFilter(filter, filterKeys)) return
|
|
||||||
if (!layer.matchFacets()) return
|
|
||||||
this.layer.addLayer(layer)
|
|
||||||
})
|
|
||||||
if (visible) this.map.addLayer(this.layer)
|
if (visible) this.map.addLayer(this.layer)
|
||||||
this.propagateRemote()
|
this.propagateRemote()
|
||||||
},
|
},
|
||||||
|
@ -498,15 +492,23 @@ L.U.DataLayer = L.Evented.extend({
|
||||||
return this.options.type === 'Cluster'
|
return this.options.type === 'Cluster'
|
||||||
},
|
},
|
||||||
|
|
||||||
|
showFeature: function (feature) {
|
||||||
|
const filterKeys = this.map.getFilterKeys(),
|
||||||
|
filter = this.map.options.filter
|
||||||
|
if (filter && !feature.matchFilter(filter, filterKeys)) return
|
||||||
|
if (!feature.matchFacets()) return
|
||||||
|
this.layer.addLayer(feature)
|
||||||
|
},
|
||||||
|
|
||||||
addLayer: function (feature) {
|
addLayer: function (feature) {
|
||||||
const id = L.stamp(feature)
|
const id = L.stamp(feature)
|
||||||
feature.connectToDataLayer(this)
|
feature.connectToDataLayer(this)
|
||||||
this._index.push(id)
|
this._index.push(id)
|
||||||
this._layers[id] = feature
|
this._layers[id] = feature
|
||||||
this.layer.addLayer(feature)
|
|
||||||
this.indexProperties(feature)
|
this.indexProperties(feature)
|
||||||
if (this.hasDataLoaded()) this.fire('datachanged')
|
|
||||||
this.map.features_index[feature.getSlug()] = feature
|
this.map.features_index[feature.getSlug()] = feature
|
||||||
|
this.showFeature(feature)
|
||||||
|
if (this.hasDataLoaded()) this.fire('datachanged')
|
||||||
},
|
},
|
||||||
|
|
||||||
removeLayer: function (feature) {
|
removeLayer: function (feature) {
|
||||||
|
|
Loading…
Reference in a new issue