Scope first-person overlay and unify elevator colors

This commit is contained in:
sudhir
2026-05-20 00:51:43 +00:00
committed by open-pascal
parent 5bd2f51d15
commit d7a1ce89f3
3 changed files with 18 additions and 21 deletions
@@ -1,6 +1,5 @@
'use client' 'use client'
import '../../three-types'
import { import {
type AnyNode, type AnyNode,
type AnyNodeId, type AnyNodeId,
@@ -45,6 +44,7 @@ import {
Vector3, Vector3,
} from 'three' } from 'three'
import { acceleratedRaycast, computeBoundsTree, disposeBoundsTree } from 'three-mesh-bvh' import { acceleratedRaycast, computeBoundsTree, disposeBoundsTree } from 'three-mesh-bvh'
import '../../three-types'
import { import {
closeDoorOpenState, closeDoorOpenState,
DOOR_SWING_OPEN_ANGLE, DOOR_SWING_OPEN_ANGLE,
@@ -1324,7 +1324,7 @@ export const FirstPersonOverlay = ({ onExit }: { onExit: () => void }) => {
return ( return (
<> <>
{isLocked && ( {isLocked && (
<div className="pointer-events-none fixed inset-0 z-40 flex items-center justify-center"> <div className="pointer-events-none absolute inset-0 z-40 flex items-center justify-center">
<div className="relative h-7 w-7"> <div className="relative h-7 w-7">
<div className="absolute top-1/2 left-1/2 h-px w-7 -translate-x-1/2 -translate-y-1/2 bg-white/60" /> <div className="absolute top-1/2 left-1/2 h-px w-7 -translate-x-1/2 -translate-y-1/2 bg-white/60" />
<div className="absolute top-1/2 left-1/2 h-7 w-px -translate-x-1/2 -translate-y-1/2 bg-white/60" /> <div className="absolute top-1/2 left-1/2 h-7 w-px -translate-x-1/2 -translate-y-1/2 bg-white/60" />
@@ -1332,7 +1332,7 @@ export const FirstPersonOverlay = ({ onExit }: { onExit: () => void }) => {
</div> </div>
)} )}
<div className="fixed top-4 right-4 z-50"> <div className="absolute top-4 right-4 z-50">
<button <button
className="pointer-events-auto flex items-center gap-2 rounded-xl border border-border/40 bg-background/90 px-4 py-2 font-medium text-foreground text-sm shadow-lg backdrop-blur-xl transition-colors hover:bg-background" className="pointer-events-auto flex items-center gap-2 rounded-xl border border-border/40 bg-background/90 px-4 py-2 font-medium text-foreground text-sm shadow-lg backdrop-blur-xl transition-colors hover:bg-background"
onClick={handleExit} onClick={handleExit}
@@ -1346,7 +1346,7 @@ export const FirstPersonOverlay = ({ onExit }: { onExit: () => void }) => {
</div> </div>
{!hasPlacedSpawn && ( {!hasPlacedSpawn && (
<div className="fixed top-4 left-1/2 z-50 -translate-x-1/2"> <div className="absolute top-4 left-1/2 z-50 -translate-x-1/2">
<div className="rounded-2xl border border-sky-300/35 bg-slate-950/88 px-4 py-2 text-center text-slate-100 text-sm shadow-lg backdrop-blur-xl"> <div className="rounded-2xl border border-sky-300/35 bg-slate-950/88 px-4 py-2 text-center text-slate-100 text-sm shadow-lg backdrop-blur-xl">
Place a Spawn Point from the Build tab to control where walkthrough starts. Place a Spawn Point from the Build tab to control where walkthrough starts.
</div> </div>
@@ -1354,7 +1354,7 @@ export const FirstPersonOverlay = ({ onExit }: { onExit: () => void }) => {
)} )}
{isLocked && ( {isLocked && (
<div className="pointer-events-none fixed top-1/2 right-6 z-40 -translate-y-1/2"> <div className="pointer-events-none absolute top-1/2 right-6 z-40 -translate-y-1/2">
<div className="flex min-w-[148px] flex-col gap-3 rounded-2xl border border-border/35 bg-background/80 px-4 py-4 shadow-lg backdrop-blur-xl"> <div className="flex min-w-[148px] flex-col gap-3 rounded-2xl border border-border/35 bg-background/80 px-4 py-4 shadow-lg backdrop-blur-xl">
<ControlHint keys={['W', 'A', 'S', 'D']} label="Move" /> <ControlHint keys={['W', 'A', 'S', 'D']} label="Move" />
<div className="h-px w-full bg-border/30" /> <div className="h-px w-full bg-border/30" />
@@ -1158,6 +1158,11 @@ export default function Editor({
<HelperManager /> <HelperManager />
</div> </div>
)} )}
{isFirstPersonMode && (
<FirstPersonOverlay
onExit={() => useEditor.getState().setFirstPersonMode(false)}
/>
)}
{viewerBanner} {viewerBanner}
{projectId ? <SnapshotCaptureOverlay projectId={projectId} /> : null} {projectId ? <SnapshotCaptureOverlay projectId={projectId} /> : null}
</> </>
@@ -1171,12 +1176,6 @@ export default function Editor({
/> />
<EditorCommands /> <EditorCommands />
<CommandPalette emptyAction={commandPaletteEmptyAction} /> <CommandPalette emptyAction={commandPaletteEmptyAction} />
{/* First-person overlay — rendered on top of normal layout */}
{isFirstPersonMode && (
<div className="pointer-events-none fixed inset-0 z-50">
<FirstPersonOverlay onExit={() => useEditor.getState().setFirstPersonMode(false)} />
</div>
)}
</> </>
)} )}
</PresetsProvider> </PresetsProvider>
@@ -1231,13 +1230,10 @@ export default function Editor({
<div className="pointer-events-auto"> <div className="pointer-events-auto">
<HelperManager /> <HelperManager />
</div> </div>
</ViewerOverlays> {isFirstPersonMode && (
{/* First-person overlay — rendered on top of normal layout */}
{isFirstPersonMode && (
<div className="pointer-events-none fixed inset-0 z-50">
<FirstPersonOverlay onExit={() => useEditor.getState().setFirstPersonMode(false)} /> <FirstPersonOverlay onExit={() => useEditor.getState().setFirstPersonMode(false)} />
</div> )}
)} </ViewerOverlays>
</> </>
)} )}
</div> </div>
+5 -4
View File
@@ -37,10 +37,11 @@ import {
} from 'three' } from 'three'
import { useShallow } from 'zustand/react/shallow' import { useShallow } from 'zustand/react/shallow'
const SHAFT_WALL_COLOR = '#d7dce4' const DEFAULT_STRUCTURE_WHITE = '#f2f0ed'
const SHAFT_SIDE_COLOR = '#4b5563' const SHAFT_WALL_COLOR = DEFAULT_STRUCTURE_WHITE
const SHAFT_TRIM_COLOR = '#eef2f7' const SHAFT_SIDE_COLOR = DEFAULT_STRUCTURE_WHITE
const CAB_COLOR = '#d7dde5' const SHAFT_TRIM_COLOR = DEFAULT_STRUCTURE_WHITE
const CAB_COLOR = DEFAULT_STRUCTURE_WHITE
const GLASS_COLOR = '#f8fafc' const GLASS_COLOR = '#f8fafc'
const DOOR_COLOR = '#8e98a6' const DOOR_COLOR = '#8e98a6'
const PANEL_COLOR = '#1f2937' const PANEL_COLOR = '#1f2937'