fix(map): draw points of interest on the world copy the view is on

POIs fetched for a view west of the trip frame's seam were drawn one world
away, off screen.
This commit is contained in:
Maurice
2026-11-05 13:02:29 +01:00
parent 13376d560f
commit b9c53d692b
6 changed files with 103 additions and 11 deletions
@@ -57,6 +57,23 @@ export function ViewportController({ onViewportChange }: { onViewportChange?: Ma
return null;
}
/**
* Reports the longitude of the view's centre once the map is laid out and after every
* move, for the layers drawn on the world copy in view rather than in the trip's frame.
*/
export function ViewCenterTracker({ onChange }: { onChange: (centerLng: number) => void }) {
const map = useMap();
useEffect(() => {
const emit = () => onChange(map.getCenter().lng);
map.whenReady(emit);
map.on('moveend', emit);
return () => {
map.off('moveend', emit);
};
}, [map, onChange]);
return null;
}
/**
* Moves the view along when the longitude frame changes under it (#2975): the trip
* is then drawn one world further east or west, and a view left where it was would