UX: also zoom to appropriate zoom level, see #1938

This commit is contained in:
Pieter Vander Vennet 2024-04-30 18:56:50 +02:00
parent d4367e017a
commit 69a4ac0261

View file

@ -21,6 +21,7 @@ export default class InitialMapPositioning {
public zoom: UIEventSource<number>
public location: UIEventSource<{ lon: number; lat: number }>
public useTerrain: Store<boolean>
constructor(layoutToUse: LayoutConfig, downloader: OsmObjectDownloader) {
function localStorageSynced(
key: string,
@ -76,6 +77,8 @@ export default class InitialMapPositioning {
if (osmObject === "deleted") {
return
}
const targetLayer = layoutToUse.getMatchingLayer(osmObject.tags)
this.zoom.setData(Math.max(this.zoom.data, targetLayer.minzoom))
const [lat, lon] = osmObject.centerpoint()
this.location.setData({ lon, lat })
})