diff --git a/client/src/components/Map3D.jsx b/client/src/components/Map3D.jsx index a26476b..0de4944 100644 --- a/client/src/components/Map3D.jsx +++ b/client/src/components/Map3D.jsx @@ -1282,16 +1282,133 @@ function Scene({ interactionMode, onInteraction }) { ); } +// Interaction mode toolbar overlay +function InteractionToolbar({ mode, setMode, lastInteraction }) { + const modes = [ + { key: INTERACTION_MODE.LOOK, icon: '๐Ÿ‘๏ธ', label: 'Look', desc: 'Orbit camera' }, + { key: INTERACTION_MODE.MOVE, icon: '๐ŸŽฏ', label: 'Move', desc: 'Click to send turtle' }, + { key: INTERACTION_MODE.BUILD, icon: '๐Ÿงฑ', label: 'Build', desc: 'Click face to preview' }, + { key: INTERACTION_MODE.SELECT, icon: 'โฌœ', label: 'Select', desc: 'Click two corners' }, + ]; + + return ( +
+ {modes.map(m => ( + + ))} + + {lastInteraction && ( +
+ {lastInteraction.mode === 'move' && `๐ŸŽฏ Moving turtle to (${lastInteraction.target.x}, ${lastInteraction.target.y}, ${lastInteraction.target.z})`} + {lastInteraction.mode === 'build' && `๐Ÿงฑ Build at (${lastInteraction.target.x}, ${lastInteraction.target.y}, ${lastInteraction.target.z})`} + {lastInteraction.mode === 'select' && lastInteraction.end && + `โฌœ Selected (${lastInteraction.start.x},${lastInteraction.start.y},${lastInteraction.start.z}) โ†’ (${lastInteraction.end.x},${lastInteraction.end.y},${lastInteraction.end.z})`} +
+ )} +
+ ); +} + +// Block count HUD +function BlockCountHUD({ blocks }) { + const count = blocks.length; + const chunkCount = useMemo(() => { + const chunks = new Set(); + blocks.forEach(b => chunks.add(`${Math.floor(b.x / 16)},${Math.floor(b.z / 16)}`)); + return chunks.size; + }, [blocks]); + + return ( +
+ ๐ŸงŠ {count.toLocaleString()} blocks ยท ๐Ÿ“ฆ {chunkCount} chunks +
+ ); +} + // Main Map3D component export default function Map3D() { + const [interactionMode, setInteractionMode] = useState(INTERACTION_MODE.LOOK); + const [lastInteraction, setLastInteraction] = useState(null); + const worldBlocks = useTurtleStore((state) => state.worldBlocks || []); + + const handleInteraction = useCallback((event) => { + setLastInteraction(event); + // Clear notification after 5 seconds + setTimeout(() => setLastInteraction(null), 5000); + }, []); + return ( -
+
- + + + +
); }