diff --git a/src/App.jsx b/src/App.jsx index 73fbf66..64eebd7 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -872,6 +872,8 @@ const App = () => { showWSJTX={mapLayers.showWSJTX} onToggleSatellites={toggleSatellites} hoveredSpot={hoveredSpot} + leftSidebarVisible={leftSidebarVisible} + rightSidebarVisible={rightSidebarVisible} />
{ const mapRef = useRef(null); const mapInstanceRef = useRef(null); @@ -172,7 +174,7 @@ export const WorldMap = ({ // Update tile layer when style changes useEffect(() => { if (!mapInstanceRef.current || !tileLayerRef.current) return; - + mapInstanceRef.current.removeLayer(tileLayerRef.current); tileLayerRef.current = L.tileLayer(MAP_STYLES[mapStyle].url, { attribution: MAP_STYLES[mapStyle].attribution, @@ -180,13 +182,25 @@ export const WorldMap = ({ crossOrigin: 'anonymous', bounds: [[-85, -180], [85, 180]] }).addTo(mapInstanceRef.current); - + // Ensure terminator is on top if (terminatorRef.current) { terminatorRef.current.bringToFront(); } }, [mapStyle]); + // Invalidate map size when sidebars are toggled + // This ensures Leaflet recalculates the container dimensions + useEffect(() => { + if (!mapInstanceRef.current) return; + const timer = setTimeout(() => { + if (mapInstanceRef.current) { + mapInstanceRef.current.invalidateSize(); + } + }, 100); + return () => clearTimeout(timer); + }, [leftSidebarVisible, rightSidebarVisible]); + // Countries overlay for "Countries" map style useEffect(() => { if (!mapInstanceRef.current) return;