MCPcopy
hub / github.com/pascalorg/editor / commitCeilingDrawing

Function commitCeilingDrawing

packages/nodes/src/ceiling/tool.tsx:61–72  ·  view source on GitHub ↗
(levelId: LevelNode['id'], points: Array<[number, number]>)

Source from the content-addressed store, hash-verified

59}
60
61function 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
74export const CeilingTool: React.FC = () => {
75 const cursorRef = useRef<Group>(null)

Callers 2

onGridClickFunction · 0.85
onGridDoubleClickFunction · 0.85

Calls 2

triggerSFXFunction · 0.90
createNodeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…