From b4f3c7db4d129e064835633d5508bd97fe4c29f0 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 6 Mar 2026 19:40:35 +0100 Subject: [PATCH] Fix: Stop globe rotation while station panel is open Auto-rotation now stops completely when a station list or favorites sidebar is visible. Resumes only when all panels are closed. Interaction-based pause (drag/scroll) also respects open panels - won't resume after 5s timeout if a sidebar is still showing. Co-Authored-By: Claude Opus 4.6 --- web/src/plugins/radio/RadioTab.tsx | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) 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) => {