viewer: disable interaction prompt once use clicked on axes
This commit is contained in:
parent
719641ca7b
commit
741b367952
1 changed files with 4 additions and 1 deletions
|
|
@ -25,6 +25,7 @@ export default function ViewerPanel({className, style}: {className?: string, sty
|
||||||
if (!model) throw new Error('No model');
|
if (!model) throw new Error('No model');
|
||||||
|
|
||||||
const state = model.state;
|
const state = model.state;
|
||||||
|
const [interactionPrompt, setInteractionPrompt] = useState('auto');
|
||||||
const modelViewerRef = useRef<any>();
|
const modelViewerRef = useRef<any>();
|
||||||
const axesViewerRef = useRef<any>();
|
const axesViewerRef = useRef<any>();
|
||||||
const toastRef = useRef<Toast>(null);
|
const toastRef = useRef<Toast>(null);
|
||||||
|
|
@ -62,6 +63,7 @@ export default function ViewerPanel({className, style}: {className?: string, sty
|
||||||
orbit.phi = phi;
|
orbit.phi = phi;
|
||||||
const newOrbit = modelViewerRef.current.cameraOrbit = axesViewerRef.current.cameraOrbit = orbit.toString();
|
const newOrbit = modelViewerRef.current.cameraOrbit = axesViewerRef.current.cameraOrbit = orbit.toString();
|
||||||
toastRef.current?.show({severity: 'info', detail: `${name} view`, life: 1000,});
|
toastRef.current?.show({severity: 'info', detail: `${name} view`, life: 1000,});
|
||||||
|
setInteractionPrompt('none');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
window.addEventListener('click', onClick);
|
window.addEventListener('click', onClick);
|
||||||
|
|
@ -78,7 +80,7 @@ export default function ViewerPanel({className, style}: {className?: string, sty
|
||||||
width: '100%',
|
width: '100%',
|
||||||
...(style ?? {})
|
...(style ?? {})
|
||||||
}}>
|
}}>
|
||||||
<Toast ref={toastRef} position='bottom-right' />
|
<Toast ref={toastRef} position='top-right' />
|
||||||
<model-viewer
|
<model-viewer
|
||||||
orientation="0deg -90deg 0deg"
|
orientation="0deg -90deg 0deg"
|
||||||
class="main-viewer"
|
class="main-viewer"
|
||||||
|
|
@ -87,6 +89,7 @@ export default function ViewerPanel({className, style}: {className?: string, sty
|
||||||
width: '100%',
|
width: '100%',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
}}
|
}}
|
||||||
|
interaction-prompt={interactionPrompt}
|
||||||
environment-image="./skybox-lights.jpg"
|
environment-image="./skybox-lights.jpg"
|
||||||
max-camera-orbit="auto 180deg auto"
|
max-camera-orbit="auto 180deg auto"
|
||||||
min-camera-orbit="auto 0deg auto"
|
min-camera-orbit="auto 0deg auto"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue