Performance improvements
This commit is contained in:
parent
ce30b159f9
commit
614158e3c6
1 changed files with 7 additions and 5 deletions
|
@ -39,8 +39,6 @@ export default class FilteringFeatureSource implements FeatureSource {
|
||||||
|
|
||||||
for (const layer of layers) {
|
for (const layer of layers) {
|
||||||
layerDict[layer.layerDef.id] = layer;
|
layerDict[layer.layerDef.id] = layer;
|
||||||
layer.isDisplayed.addCallback(() => {
|
|
||||||
update()})
|
|
||||||
}
|
}
|
||||||
upstream.features.addCallback(() => {
|
upstream.features.addCallback(() => {
|
||||||
update()});
|
update()});
|
||||||
|
@ -48,12 +46,16 @@ export default class FilteringFeatureSource implements FeatureSource {
|
||||||
// We want something that is stable for the shown layers
|
// We want something that is stable for the shown layers
|
||||||
const displayedLayerIndexes = [];
|
const displayedLayerIndexes = [];
|
||||||
for (let i = 0; i < layers.length; i++) {
|
for (let i = 0; i < layers.length; i++) {
|
||||||
if(l.zoom <= layers[i].layerDef.minzoom){
|
if(l.zoom < layers[i].layerDef.minzoom){
|
||||||
displayedLayerIndexes.push(i);
|
continue;
|
||||||
}
|
}
|
||||||
|
if(!layers[i].isDisplayed.data){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
displayedLayerIndexes.push(i);
|
||||||
}
|
}
|
||||||
return displayedLayerIndexes.join(",")
|
return displayedLayerIndexes.join(",")
|
||||||
})
|
}, layers.map(l => l.isDisplayed))
|
||||||
.addCallback(() => {
|
.addCallback(() => {
|
||||||
update();});
|
update();});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue