Reduce cyclomatic complexity below 20 in all functions
Extract dispatch branches into focused helpers:
use-canvas-input.ts (5 functions, was 21–61):
- onMouseDown → handleSelectDown, startPanDrag, tryStartRotation,
tryStartResize, handleTextEditClick, duplicateAndDrag
- onMouseMove → dragNodes, updatePan, updateRotation,
extendTextSelection, updateDrawShape, updateMarquee
- onMouseUp → commitDrag, commitDrawing, reparentOutsideNodes
- applyResize → constrainToAspectRatio
- computeAutoLayoutIndicatorForFrame → computeIndicatorPosition
use-keyboard.ts (was 39):
- onEventFired → shouldPreventDefault + Set-based lookups
server.ts (was 34):
- handleRequest → Partial<Record> command dispatch map
LayerTree.vue (was 22):
- updateDropTarget → classifyDropZone, resolveInsertPosition
use-text-edit.ts (was 27):
- onKeyDown → handleDeletion, handleHorizontalArrow, metaKeyActions map