Adicionou botão Toggle Grid e Menu
X-Lovable-Edit-ID: edt-af6390fe-71e5-4081-9dc0-ed63f952cdc0 Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com>
This commit is contained in:
@@ -63,6 +63,7 @@ export function XRHudInWorld(props: XRHudInWorldProps) {
|
||||
|
||||
const panelRef = useRef<THREE.Group>(null);
|
||||
const wristRef = useRef<THREE.Group>(null);
|
||||
const headLockRef = useRef<THREE.Group>(null);
|
||||
const targetPos = useRef(new THREE.Vector3());
|
||||
const targetQuat = useRef(new THREE.Quaternion());
|
||||
const lastABtn = useRef(false);
|
||||
@@ -144,11 +145,33 @@ export function XRHudInWorld(props: XRHudInWorldProps) {
|
||||
wristRef.current.visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Head-locked fallback toggle — always visible in lower-left of FOV,
|
||||
// so the user can reopen the menu even without controllers or if the
|
||||
// panel is positioned out of view.
|
||||
if (headLockRef.current) {
|
||||
const offset = new THREE.Vector3(-0.18, -0.18, -0.5).applyQuaternion(camera.quaternion);
|
||||
headLockRef.current.position.copy(camera.position).add(offset);
|
||||
headLockRef.current.quaternion.copy(camera.quaternion);
|
||||
}
|
||||
});
|
||||
|
||||
const showGrid = useModelStore((s) => s.showGrid);
|
||||
const setShowGrid = useModelStore((s) => s.setShowGrid);
|
||||
|
||||
return (
|
||||
<>
|
||||
<WristToggle ref={wristRef} open={open} onToggle={() => setOpen((v) => !v)} />
|
||||
{/* Head-locked fallback: always-visible quick controls in lower-left of FOV */}
|
||||
<group ref={headLockRef} renderOrder={999}>
|
||||
<XR3DButton position={[0, 0.018, 0]} size={[0.07, 0.022]}
|
||||
label={open ? '✕ Menu' : '☰ Menu'} active={open}
|
||||
onClick={() => { setOpen((v) => !v); reanchorRequested.current = true; }}
|
||||
fontSize={0.0085} />
|
||||
<XR3DButton position={[0, -0.008, 0]} size={[0.07, 0.022]}
|
||||
label={showGrid ? 'Grid ON' : 'Grid OFF'} active={showGrid}
|
||||
onClick={() => setShowGrid(!showGrid)} fontSize={0.0085} />
|
||||
</group>
|
||||
{open && (
|
||||
<group ref={panelRef}>
|
||||
<FloatingPanel
|
||||
|
||||
@@ -319,7 +319,7 @@ export const useModelStore = create<ModelStore>((set, get) => ({
|
||||
renderMode: 'solid',
|
||||
setRenderMode: (renderMode) => set({ renderMode }),
|
||||
|
||||
showGrid: true,
|
||||
showGrid: false,
|
||||
setShowGrid: (showGrid) => set({ showGrid }),
|
||||
|
||||
gridY: -0.09,
|
||||
|
||||
Reference in New Issue
Block a user