forked from MapComplete/MapComplete
		
	Performance improvement
This commit is contained in:
		
							parent
							
								
									6557c51493
								
							
						
					
					
						commit
						ce30b159f9
					
				
					 1 changed files with 11 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -44,7 +44,17 @@ export default class FilteringFeatureSource implements FeatureSource {
 | 
			
		|||
        }
 | 
			
		||||
        upstream.features.addCallback(() => {
 | 
			
		||||
            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();});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue