fix: restore fence tool handlers dropped by null-guard commit

251af2c added a `?.` on cursorRef in onGridClick but inadvertently
deleted the closing braces, the trailing reset block, and the
onKeyDown/onKeyUp/onCancel handlers — leaving onGridClick syntactically
unterminated and three undefined references at the emitter.on/off sites.
Restores the deleted block verbatim, keeping the optional-chaining null
guard on cursorRef.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Wassim SAMAD
2026-05-20 08:15:26 -04:00
co-authored by Claude Opus 4.7
parent 820c5d9e3e
commit d218cb7f26
+20
View File
@@ -510,6 +510,26 @@ export const FenceTool: React.FC = () => {
startingPoint.current.set(nextStart[0], event.localPosition[1], nextStart[1]) startingPoint.current.set(nextStart[0], event.localPosition[1], nextStart[1])
endingPoint.current.copy(startingPoint.current) endingPoint.current.copy(startingPoint.current)
cursorRef.current?.position.copy(startingPoint.current) cursorRef.current?.position.copy(startingPoint.current)
previewRef.current.visible = false
buildingState.current = 1
setDraftMeasurement(null)
}
}
const onKeyDown = (e: KeyboardEvent) => {
if (e.key === 'Shift') shiftPressed.current = true
}
const onKeyUp = (e: KeyboardEvent) => {
if (e.key === 'Shift') shiftPressed.current = false
}
const onCancel = () => {
if (buildingState.current === 1) {
markToolCancelConsumed()
stopDrafting()
}
}
emitter.on('grid:move', onGridMove) emitter.on('grid:move', onGridMove)
emitter.on('grid:click', onGridClick) emitter.on('grid:click', onGridClick)