small changes
This commit is contained in:
1 parent
5724560171
commit
0e65b8c446
4 files changed
+17
-9
No files matched your search
@@ -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',
|
||||
|
||||
Reference in new issue
Block a user