diff --git a/web/src/plugins/radio/RadioTab.tsx b/web/src/plugins/radio/RadioTab.tsx index 06f7af8..87a50b7 100644 --- a/web/src/plugins/radio/RadioTab.tsx +++ b/web/src/plugins/radio/RadioTab.tsx @@ -163,17 +163,36 @@ export default function RadioTab({ data }: { data: any }) { } }, [theme]); - // ── Helper: pause globe rotation for 5s ── + // ── Helper: pause globe rotation for 5s (only resumes if no panel open) ── + const selectedPlaceRef = useRef(selectedPlace); + selectedPlaceRef.current = selectedPlace; + const showFavoritesRef = useRef(showFavorites); + showFavoritesRef.current = showFavorites; + const pauseRotation = useCallback(() => { const controls = globeRef.current?.controls() as any; if (controls) controls.autoRotate = false; if (rotationResumeRef.current) clearTimeout(rotationResumeRef.current); rotationResumeRef.current = setTimeout(() => { + // Only resume if no sidebar is open + if (selectedPlaceRef.current || showFavoritesRef.current) return; const c = globeRef.current?.controls() as any; if (c) c.autoRotate = true; }, 5000); }, []); + // ── Stop/resume rotation when panels open/close ── + useEffect(() => { + const controls = globeRef.current?.controls() as any; + if (!controls) return; + if (selectedPlace || showFavorites) { + controls.autoRotate = false; + if (rotationResumeRef.current) clearTimeout(rotationResumeRef.current); + } else { + controls.autoRotate = true; + } + }, [selectedPlace, showFavorites]); + // ── Point click handler (stable ref) ── const handlePointClickRef = useRef<(point: any) => void>(undefined); handlePointClickRef.current = (point: any) => {