diff --git a/dist/index.html b/dist/index.html index bb04329..c21279b 100644 --- a/dist/index.html +++ b/dist/index.html @@ -5,7 +5,7 @@ furniture-app - + diff --git a/src/components/ControlPanel.tsx b/src/components/ControlPanel.tsx index 11d05e6..bdefe77 100644 --- a/src/components/ControlPanel.tsx +++ b/src/components/ControlPanel.tsx @@ -1,4 +1,4 @@ -import type { ConditionKind, Entrance, LayoutState, RoomConfig } from '../types'; +import type { ConditionKind, Entrance, FurnitureConfig, LayoutState, RoomConfig } from '../types'; interface ControlPanelProps { state: LayoutState; @@ -37,6 +37,25 @@ export function ControlPanel({ onStateChange({ ...state, entrance: { x: 20, y: 20, width: 20, height: 20 } }); }; + const createObject = () => { + const id = 'obj_' + Date.now(); + const newItem: FurnitureConfig = { + id, + name: 'Object ' + (state.furniture.length + 1), + type: 'custom', + shape: { type: 'rectangle', x: 100, y: 100, width: 50, height: 50 }, + conditions: [ + { kind: 'walk_to_and_sit', weight: 1 }, + { kind: 'accessible', weight: 1 }, + ], + color: '#90caf9', + lockedForOptimization: false, + placed: true, + }; + onStateChange({ ...state, furniture: [...state.furniture, newItem] }); + onSelect(id); + }; + const toggleLock = () => { if (!selectedId) return; const updated = state.furniture.map((f) => @@ -123,6 +142,9 @@ export function ControlPanel({ + {state.entrance && (