MCPcopy Index your code
hub / github.com/pascalorg/editor / onGridClick

Function onGridClick

packages/nodes/src/ceiling/tool.tsx:189–209  ·  view source on GitHub ↗
(_event: GridEvent)

Source from the content-addressed store, hash-verified

187 }
188
189 const onGridClick = (_event: GridEvent) => {
190 if (!currentLevelId) return
191 const clickPoint = previousSnappedPointRef.current ?? cursorPosition
192 const firstPoint = points[0]
193 if (
194 points.length >= 3 &&
195 firstPoint &&
196 Math.abs(clickPoint[0] - firstPoint[0]) < 0.25 &&
197 Math.abs(clickPoint[1] - firstPoint[1]) < 0.25
198 ) {
199 const ceilingId = commitCeilingDrawing(currentLevelId, points)
200 setSelection({ selectedIds: [ceilingId] })
201 setPoints([])
202 useAlignmentGuides.getState().clear()
203 } else {
204 // Every non-closing vertex is a "start" tick; the closing click above
205 // fires the structure-build (end) cue.
206 triggerSFX('sfx:structure-build-start')
207 setPoints([...points, clickPoint])
208 }
209 }
210
211 const onGridDoubleClick = (_event: GridEvent) => {
212 if (!currentLevelId) return

Callers

nothing calls this directly

Calls 3

triggerSFXFunction · 0.90
commitCeilingDrawingFunction · 0.85
clearMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…