mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-12 23:31:02 +00:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user