(levelId: LevelNode['id'], points: Array<[number, number]>)
| 59 | } |
| 60 | |
| 61 | function commitCeilingDrawing(levelId: LevelNode['id'], points: Array<[number, number]>): string { |
| 62 | const { createNode, nodes } = useScene.getState() |
| 63 | const ceilingCount = Object.values(nodes).filter((n) => n.type === 'ceiling').length |
| 64 | const name = `Ceiling ${ceilingCount + 1}` |
| 65 | // A placed ceiling preset seeds `toolDefaults.ceiling` (thickness, height, |
| 66 | // material, …) before the tool activates; the drawn polygon always wins. |
| 67 | const defaults = useEditor.getState().toolDefaults.ceiling ?? {} |
| 68 | const ceiling = CeilingNode.parse({ ...defaults, name, polygon: points }) |
| 69 | createNode(ceiling, levelId) |
| 70 | triggerSFX('sfx:structure-build') |
| 71 | return ceiling.id |
| 72 | } |
| 73 | |
| 74 | export const CeilingTool: React.FC = () => { |
| 75 | const cursorRef = useRef<Group>(null) |
no test coverage detected
searching dependent graphs…