From f103029af780dbef73b96bb91c5849ddcc6ccf7b Mon Sep 17 00:00:00 2001 From: gadgethd <111318106+gadgethd@users.noreply.github.com> Date: Mon, 3 Aug 2026 21:39:43 +0100 Subject: [PATCH] fix(map): never shift the map on node selection --- frontend/src/components/Map/MapLibreMap.tsx | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/frontend/src/components/Map/MapLibreMap.tsx b/frontend/src/components/Map/MapLibreMap.tsx index fa8be9a..2a0f2a7 100644 --- a/frontend/src/components/Map/MapLibreMap.tsx +++ b/frontend/src/components/Map/MapLibreMap.tsx @@ -69,12 +69,12 @@ import { computeCustomLos } from '../../utils/customLos.js'; import { fetchJson, withScopeParams, type ApiScope } from '../../utils/api.js'; import { ScopedCache } from '../../utils/scopedCache.js'; -const NODE_DOCK_RIGHT_PADDING = 372; -function mapPaddingForNode(selected: string | null): { top: number; right: number; bottom: number; left: number } { - const desktop = window.matchMedia('(min-width: 641px)').matches; +// The node detail dock is an overlay, so node selection must never reserve +// camera padding or shift the visible map. +function mapPaddingForNode(_selected: string | null): { top: number; right: number; bottom: number; left: number } { return { top: 0, - right: selected && desktop ? NODE_DOCK_RIGHT_PADDING : 0, + right: 0, bottom: 0, left: 0, }; @@ -267,13 +267,6 @@ export function MapLibreMap({ } }, [mapLight]); - // Keep the map's usable camera area clear of the right-side node dock. - useEffect(() => { - const map = mapRef.current; - if (!map || !mapLoadedRef.current) return; - map.setPadding(mapPaddingForNode(selectedNodeId)); - }, [selectedNodeId]); - // -- LOS profiles (client-side, multi-node, auto-expire) ------------------- const addLosLoading = useOverlayStore((state) => state.addLosLoading); @@ -853,7 +846,7 @@ export function MapLibreMap({ }); mapRef.current = map; - map.setPadding(mapPaddingForNode(selectedNodeIdRef.current)); + map.setPadding(mapPaddingForNode(null)); onMapReady?.(map); refreshMapSources();