fix(atlas): measure the opening pan only where there is chrome to clear

The opening view asked Leaflet for the north edge's point on every atlas,
though only the touch shell's rail and header need a pan. The desktop atlas
now opens exactly as before, without the call, which its map mocks also
never had.
This commit is contained in:
Maurice
2026-11-08 00:02:20 +01:00
parent 27aab5c783
commit dfd87d413e
+3 -1
View File
@@ -374,7 +374,9 @@ export function useAtlas(options: { chromeInsets?: () => AtlasChromeInsets } = {
mapInstance.current = map
// The opening view centres the world beside the screen's chrome, not behind the rail and under the header.
const pan = chromePan(chromeInsetsRef.current?.(), map.latLngToContainerPoint([NORTH_EDGE_LAT, 0]).y)
// Measured only where there is chrome to clear: the desktop atlas opens exactly as before.
const insets = chromeInsetsRef.current?.()
const pan = insets ? chromePan(insets, map.latLngToContainerPoint([NORTH_EDGE_LAT, 0]).y) : null
if (pan) map.panBy(pan, { animate: false })
// Both renderers live as long as the map does (see the note on the refs); map.remove()
// disposes them along with every other layer it holds.