From dfd87d413ea2e4826e9a9b087188e381aff0f798 Mon Sep 17 00:00:00 2001 From: Maurice Date: Sun, 8 Nov 2026 00:02:20 +0100 Subject: [PATCH] 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. --- client/src/pages/atlas/useAtlas.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/pages/atlas/useAtlas.ts b/client/src/pages/atlas/useAtlas.ts index 6303f45f9..2d56c0457 100644 --- a/client/src/pages/atlas/useAtlas.ts +++ b/client/src/pages/atlas/useAtlas.ts @@ -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.