forked from MapComplete/MapComplete
		
	Don't calculate tile bounds if not sufficiently zoomed
This commit is contained in:
		
							parent
							
								
									c31a50b139
								
							
						
					
					
						commit
						725a3c37c7
					
				
					 1 changed files with 8 additions and 3 deletions
				
			
		|  | @ -82,8 +82,6 @@ export default class FeaturePipeline { | |||
|         const useOsmApi = state.locationControl.map(l => l.zoom > (state.overpassMaxZoom.data ?? 12)) | ||||
|         this.relationTracker = new RelationsTracker() | ||||
| 
 | ||||
|         const neededTilesFromOsm = this.getNeededTilesFromOsm() | ||||
| 
 | ||||
| 
 | ||||
|         this.sufficientlyZoomed = state.locationControl.map(location => { | ||||
|                 if (location?.zoom === undefined) { | ||||
|  | @ -94,6 +92,7 @@ export default class FeaturePipeline { | |||
|             } | ||||
|         ); | ||||
| 
 | ||||
|         const neededTilesFromOsm = this.getNeededTilesFromOsm(this.sufficientlyZoomed) | ||||
| 
 | ||||
|         const perLayerHierarchy = new Map<string, TileHierarchyMerger>() | ||||
|         this.perLayerHierarchy = perLayerHierarchy | ||||
|  | @ -260,12 +259,15 @@ export default class FeaturePipeline { | |||
|         return oldestDate | ||||
|     } | ||||
| 
 | ||||
|     private getNeededTilesFromOsm(): UIEventSource<number[]> { | ||||
|     private getNeededTilesFromOsm(isSufficientlyZoomed: UIEventSource<boolean>): UIEventSource<number[]> { | ||||
|         const self = this | ||||
|         return this.state.currentBounds.map(bbox => { | ||||
|             if (bbox === undefined) { | ||||
|                 return | ||||
|             } | ||||
|             if (!isSufficientlyZoomed.data) { | ||||
|                 return; | ||||
|             } | ||||
|             const osmSourceZoomLevel = self.osmSourceZoomLevel | ||||
|             const range = bbox.containingTileRange(osmSourceZoomLevel) | ||||
|             const tileIndexes = [] | ||||
|  | @ -300,6 +302,9 @@ export default class FeaturePipeline { | |||
|             if (bbox === undefined) { | ||||
|                 return true | ||||
|             } | ||||
|             if (!this.sufficientlyZoomed?.data) { | ||||
|                 return true; | ||||
|             } | ||||
|             let zoom = state.locationControl.data.zoom | ||||
|             if (zoom < minzoom) { | ||||
|                 return true; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue