diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 2eae8d1..5d79f88 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -11,6 +11,7 @@ export const metadata: Metadata = { export default function RootLayout({ children }: LayoutProps<"/">) { return ( + diff --git a/src/app/page.tsx b/src/app/page.tsx index 7e3f7f6..deeae28 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -25,7 +25,6 @@ export default function Main() { const step = Number.parseInt(stepStr) || 0; useEffect(() => { - return; if (!hasAttachedListerner && step > 0) { const doFullscreen = () => { if (screenfull.isEnabled) { diff --git a/src/components/Riddle_7_AR_View.tsx b/src/components/Riddle_7_AR_View.tsx index f0a718d..aaa5e2f 100644 --- a/src/components/Riddle_7_AR_View.tsx +++ b/src/components/Riddle_7_AR_View.tsx @@ -35,13 +35,21 @@ export default function Riddle_7_AR_View({ const arSystem = sceneEl.systems['mindar-image-system']; - const handleRenderStart = () => { + const startAR = () => { if (arSystem) { - arSystem.start(); + try { + arSystem.start(); + } catch (error) { + console.warn('AR System start error:', error); + } } }; - sceneEl.addEventListener('renderstart', handleRenderStart); + if (sceneEl.hasLoaded) { + startAR(); + } else { + sceneEl.addEventListener('loaded', startAR, { once: true }); + } targetsRef.current.forEach((targetEl, index) => { if (!targetEl) return; @@ -51,7 +59,7 @@ export default function Riddle_7_AR_View({ const targetConfig = TARGET_CONFIG.find((t) => t.targetIndex === index); if (targetConfig) { - setShowNextButton(false); + setShowNextButton?.(false); setActiveVideo(targetConfig); } }; @@ -66,7 +74,7 @@ export default function Riddle_7_AR_View({ return () => { if (sceneEl) { - sceneEl.removeEventListener('renderstart', handleRenderStart); + sceneEl.removeEventListener('loaded', startAR); } if (arSystem) { try { @@ -125,8 +133,8 @@ export default function Riddle_7_AR_View({ position: 'fixed', top: 0, left: 0, - width: '100vw', - height: '100vh', + width: '100dvw', + height: '100dvh', backgroundColor: '#000', zIndex: 9999, display: 'flex', diff --git a/src/css/Tour.module.css b/src/css/Tour.module.css index c14ea9c..686d5f7 100644 --- a/src/css/Tour.module.css +++ b/src/css/Tour.module.css @@ -3,7 +3,7 @@ flex-direction: column; height: 100dvh; width: 100%; - overflow: hidden; + overflow: auto; } .top-bar { position: absolute;