Phase 5 Stage D fence: port MoveFenceEndpointTool to DragAction
Second Stage D affordance port (425 LoC legacy → ~430 split across
action + wrapper). All math (snap, linked-fence cascade, alt-detach,
min-length gate, single-undo dance) lives in the pure
`moveFenceEndpointDragAction`. The React wrapper handles the UI
overlays (cursor sphere, Drag/Detach badge, angle label) and the live
state subscriptions.
The action introduces the single-undo dance pattern for multi-write
commits: `commit()` calls `scene.restoreAll()` → `resumeHistory()` →
re-applies the final draft so zundo records the entire drag as one
undo step. Reusable shape for slab/wall/door endpoint ports.
Transitional exports added to `@pascal-app/editor`'s public surface
(`snapFenceDraftPoint`, `isWallLongEnough`, the segment-angle helpers,
`MovingFenceEndpoint`). Stage F cleanup moves these into
`@pascal-app/nodes` once every consumer is registry-driven.
`getRegistryAffordanceTool` is now generic (`ComponentType<any>`) so
affordances with different prop shapes (`{ node }`, `{ target }`, …)
all dispatch through the same helper.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
ee309ece6f
commit
05efa25edb
@@ -76,6 +76,10 @@ export const fenceDefinition: NodeDefinition<typeof FenceNode> = {
|
||||
// actions/curve.ts; this component is the React wrapper using
|
||||
// useDragAction + the cursor visuals.
|
||||
curve: () => import('./curve-tool'),
|
||||
// Triggered by useEditor.movingFenceEndpoint. Pure logic in
|
||||
// actions/move-endpoint.ts (linked-fence cascade, alt-detach,
|
||||
// single-undo dance). Wrapper owns the angle label + detach badge.
|
||||
'move-endpoint': () => import('./move-endpoint-tool'),
|
||||
},
|
||||
|
||||
toolHints: [
|
||||
|
||||
Reference in New Issue
Block a user