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))
|
const useOsmApi = state.locationControl.map(l => l.zoom > (state.overpassMaxZoom.data ?? 12))
|
||||||
this.relationTracker = new RelationsTracker()
|
this.relationTracker = new RelationsTracker()
|
||||||
|
|
||||||
const neededTilesFromOsm = this.getNeededTilesFromOsm()
|
|
||||||
|
|
||||||
|
|
||||||
this.sufficientlyZoomed = state.locationControl.map(location => {
|
this.sufficientlyZoomed = state.locationControl.map(location => {
|
||||||
if (location?.zoom === undefined) {
|
if (location?.zoom === undefined) {
|
||||||
|
@ -94,6 +92,7 @@ export default class FeaturePipeline {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const neededTilesFromOsm = this.getNeededTilesFromOsm(this.sufficientlyZoomed)
|
||||||
|
|
||||||
const perLayerHierarchy = new Map<string, TileHierarchyMerger>()
|
const perLayerHierarchy = new Map<string, TileHierarchyMerger>()
|
||||||
this.perLayerHierarchy = perLayerHierarchy
|
this.perLayerHierarchy = perLayerHierarchy
|
||||||
|
@ -260,12 +259,15 @@ export default class FeaturePipeline {
|
||||||
return oldestDate
|
return oldestDate
|
||||||
}
|
}
|
||||||
|
|
||||||
private getNeededTilesFromOsm(): UIEventSource<number[]> {
|
private getNeededTilesFromOsm(isSufficientlyZoomed: UIEventSource<boolean>): UIEventSource<number[]> {
|
||||||
const self = this
|
const self = this
|
||||||
return this.state.currentBounds.map(bbox => {
|
return this.state.currentBounds.map(bbox => {
|
||||||
if (bbox === undefined) {
|
if (bbox === undefined) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if (!isSufficientlyZoomed.data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const osmSourceZoomLevel = self.osmSourceZoomLevel
|
const osmSourceZoomLevel = self.osmSourceZoomLevel
|
||||||
const range = bbox.containingTileRange(osmSourceZoomLevel)
|
const range = bbox.containingTileRange(osmSourceZoomLevel)
|
||||||
const tileIndexes = []
|
const tileIndexes = []
|
||||||
|
@ -300,6 +302,9 @@ export default class FeaturePipeline {
|
||||||
if (bbox === undefined) {
|
if (bbox === undefined) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
if (!this.sufficientlyZoomed?.data) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
let zoom = state.locationControl.data.zoom
|
let zoom = state.locationControl.data.zoom
|
||||||
if (zoom < minzoom) {
|
if (zoom < minzoom) {
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue