Performance improvement

This commit is contained in:
pietervdvn 2021-01-05 10:56:25 +01:00
parent 6557c51493
commit ce30b159f9

View file

@ -44,7 +44,17 @@ export default class FilteringFeatureSource implements FeatureSource {
} }
upstream.features.addCallback(() => { upstream.features.addCallback(() => {
update()}); update()});
location.map(l => l.zoom).addCallback(() => { location.map(l => {
// We want something that is stable for the shown layers
const displayedLayerIndexes = [];
for (let i = 0; i < layers.length; i++) {
if(l.zoom <= layers[i].layerDef.minzoom){
displayedLayerIndexes.push(i);
}
}
return displayedLayerIndexes.join(",")
})
.addCallback(() => {
update();}); update();});