1
0

fix cool time

This commit is contained in:
2026-03-07 03:42:10 +09:00
parent efc513be15
commit a4418a2aa9

View File

@@ -93,9 +93,13 @@ export default function App() {
}, [playAnim]); }, [playAnim]);
const appStartRef = useRef(Date.now()); const appStartRef = useRef(Date.now());
const lastSwitchRef = useRef(0);
const handleZoomOut = useCallback(() => { const handleZoomOut = useCallback(() => {
// 起動後15秒は切り替え無効 const now = Date.now();
if (Date.now() - appStartRef.current < 15000) return; // 起動後15秒、または切り替え後5秒はブロック
if (now - appStartRef.current < 15000) return;
if (now - lastSwitchRef.current < 5000) return;
lastSwitchRef.current = now;
setView('nasa'); setView('nasa');
}, []); }, []);
@@ -134,9 +138,9 @@ export default function App() {
{/* NASA center button */} {/* NASA center button */}
{isNasa && ( {isNasa && (
<button <button
onClick={() => setView('avatar')} onClick={() => { lastSwitchRef.current = Date.now(); setView('avatar'); }}
onMouseEnter={() => setView('avatar')} onMouseEnter={() => { lastSwitchRef.current = Date.now(); setView('avatar'); }}
onTouchStart={() => setView('avatar')} onTouchStart={() => { lastSwitchRef.current = Date.now(); setView('avatar'); }}
style={{ style={{
position: 'absolute', top: '50%', left: '50%', position: 'absolute', top: '50%', left: '50%',
transform: 'translate(-50%, -50%)', zIndex: 100, transform: 'translate(-50%, -50%)', zIndex: 100,