refactor(editor): delete curving + endpoint reshaping flags
Migrate `curvingWall`, `curvingFence`, `movingWallEndpoint`, `movingFenceEndpoint` (and their setters) off `useEditor` onto the authoritative interaction scope. The `reshaping` scope variant gains an `endpoint` discriminator; existence checks read `useIsCurveReshape()` / `useEndpointReshape()`, and the few sites that need the node (affordance-tool mounts, wall-vs-fence type checks) read it from `useReshapingNode()` — a frozen drag-start snapshot, mirroring the old flags so the tools' own per-frame writes don't feed back. `MovingWallEndpoint` / `MovingFenceEndpoint` move to the kind-owned tools that consume them. `editor-api` is simpler: endpoint engagement is kind-agnostic, and the `engageMove` reshape clears are gone (the scope is single-owner). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
2f2c3ef8f9
commit
cfc1fb1672
@@ -22,12 +22,11 @@ import {
|
||||
isMagneticSnapActive,
|
||||
isSegmentLongEnough,
|
||||
MeasurementPill,
|
||||
type MovingWallEndpoint,
|
||||
markToolCancelConsumed,
|
||||
snapWallDraftPointDetailed,
|
||||
triggerSFX,
|
||||
useAlignmentGuides,
|
||||
useEditor,
|
||||
useInteractionScope,
|
||||
useWallSnapIndicator,
|
||||
type WallPlanPoint,
|
||||
} from '@pascal-app/editor'
|
||||
@@ -44,9 +43,14 @@ import { useCallback, useEffect, useRef, useState } from 'react'
|
||||
* dismisses without committing.
|
||||
*
|
||||
* Mounted via `def.affordanceTools['move-endpoint']` from
|
||||
* `wall/definition.ts`. Editor state trigger is
|
||||
* `useEditor.movingWallEndpoint`.
|
||||
* `wall/definition.ts`. Triggered by an `endpoint` reshape scope; ToolManager
|
||||
* reconstructs this `target` from the reshaped node + the scope's endpoint.
|
||||
*/
|
||||
export type MovingWallEndpoint = {
|
||||
wall: WallNode
|
||||
endpoint: 'start' | 'end'
|
||||
}
|
||||
|
||||
/** Figma-style alignment-snap threshold (meters), matching the item move /
|
||||
* placement tools. 8 cm gives a magnetic pull without fighting grid snap. */
|
||||
const ALIGNMENT_THRESHOLD_M = 0.08
|
||||
@@ -202,7 +206,9 @@ export const MoveWallEndpointTool: React.FC<{ target: MovingWallEndpoint }> = ({
|
||||
const unit = useViewer((s) => s.unit)
|
||||
|
||||
const exitMoveMode = useCallback(() => {
|
||||
useEditor.getState().setMovingWallEndpoint(null)
|
||||
useInteractionScope
|
||||
.getState()
|
||||
.endIf((scope) => scope.kind === 'reshaping' && scope.reshape === 'endpoint')
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
Reference in New Issue
Block a user