docs(arch): record wall/fence Alt→chain-toggle + altKey-alignment known-legacy

interaction-scope.md + review-architecture skill: the sanctioned Alt-as-toggle
(wall/fence chain mode, the one place Alt-as-force is meaningless), and a second
known-legacy pattern — `event.altKey` alignment-bypass in the roof/polygon/slab
previews + ceiling/slab snap paths (migrate-on-touch; wall+fence already done).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Wassim SAMAD
2026-06-26 11:58:11 -04:00
co-authored by Claude Opus 4.8
parent 2666b07479
commit 76089d85ea
2 changed files with 21 additions and 10 deletions
+2 -1
View File
@@ -145,7 +145,8 @@ Apply when the diff touches a tool, a `move-tool` / `selection` / endpoint / res
- **No hardcoded, ungated grid step.** A quantize that isn't gated on `isGridSnapActive()` — always `useEditor.getState().gridSnapStep`, or a constant `WALL_GRID_STEP` / `0.5` / `getSegmentGridStep()` applied unconditionally — ignores the active mode and is a **blocker**. The gated form is `const step = isGridSnapActive() ? useEditor.getState().gridSnapStep : 0`. - **No hardcoded, ungated grid step.** A quantize that isn't gated on `isGridSnapActive()` — always `useEditor.getState().gridSnapStep`, or a constant `WALL_GRID_STEP` / `0.5` / `getSegmentGridStep()` applied unconditionally — ignores the active mode and is a **blocker**. The gated form is `const step = isGridSnapActive() ? useEditor.getState().gridSnapStep : 0`.
- **Snappable kinds declare `snapProfile`.** A kind whose tool snaps but whose `NodeDefinition` omits `snapProfile` (`'item' | 'structural'`) gets no contextual chip and the wrong default mode-set — flag it (suggestion, blocker if it ships a bespoke per-kind snapping switch instead). - **Snappable kinds declare `snapProfile`.** A kind whose tool snaps but whose `NodeDefinition` omits `snapProfile` (`'item' | 'structural'`) gets no contextual chip and the wrong default mode-set — flag it (suggestion, blocker if it ships a bespoke per-kind snapping switch instead).
- **Bespoke movers must not open a `moving` scope.** `useMovingNode()` reads the scope, and `tool-manager` mounts the generic `MoveRegistryNodeTool` whenever it's non-null. A bespoke `move-tool.tsx` that calls `begin(movingScope(...))` or `setMovingNode(node)` re-creates the dual-path double-handling (FPS collapse / teleport on move). **Blocker.** Mode-driven snapping inside a bespoke mover must resolve the mode without a global `moving` / `reshaping` scope (see `interaction-scope.md` § "Snapping mode & modifiers"). - **Bespoke movers must not open a `moving` scope.** `useMovingNode()` reads the scope, and `tool-manager` mounts the generic `MoveRegistryNodeTool` whenever it's non-null. A bespoke `move-tool.tsx` that calls `begin(movingScope(...))` or `setMovingNode(node)` re-creates the dual-path double-handling (FPS collapse / teleport on move). **Blocker.** Mode-driven snapping inside a bespoke mover must resolve the mode without a global `moving` / `reshaping` scope (see `interaction-scope.md` § "Snapping mode & modifiers").
- **Known-legacy exceptions (migrate on touch).** The MEP move/endpoint tools (`packages/nodes/src/{duct-segment,pipe-segment,liquid-line,lineset,duct-fitting}/{move-tool,selection}.tsx`) still carry the legacy `shiftKey` bypass; they are tracked debt in `plans/editor-placement-interaction-overhaul.md`. A PR that **touches** one of these must migrate it onto the model above, not extend the legacy path. A PR that adds a **new** tool on the legacy `shiftKey`-bypass pattern is a blocker regardless. - **`event.altKey` is not an alignment bypass.** A drafting/preview path that reads `event.altKey` to suppress Figma-alignment is a **blocker** in any **new** or **touched** tool — alignment follows the magnetic snap mode (`bypass: !isMagneticSnapActive()`). Alt is force/free for placement/move; it is **not** a snap/alignment modifier. The one sanctioned Alt use outside force is the **wall/fence chain-mode toggle** (clean Alt-tap → `cycleWallChainMode` / `cycleFenceChainMode`, via `hooks/use-keyboard.ts` `isChainModeContext()`), allowed only because wall/fence drafting has no force role. Grep tell: `event.altKey` near an `align` / `bypass` expression in a `tool.tsx` / floorplan preview path.
- **Known-legacy exceptions (migrate on touch).** Tracked debt in `plans/editor-placement-interaction-overhaul.md`; a PR that **touches** one must migrate it, not extend it; a **new** tool on either legacy pattern is a blocker regardless. (1) `shiftKey` snap-bypass in the MEP move/endpoint tools (`packages/nodes/src/{duct-segment,pipe-segment,liquid-line,lineset,duct-fitting}/{move-tool,selection}.tsx`). (2) `altKey` alignment-bypass in the roof / polygon / slab pointer-move previews (`components/editor/floorplan-panel.tsx`) and the `resolveSlabPlanPointSnap` / `resolveCeilingPlanPointSnap` paths. **Already migrated — do not regress:** wall + fence drafting (both modifier patterns).
## 5. Output format ## 5. Output format
+19 -9
View File
@@ -131,19 +131,29 @@ There is no per-kind snapping switch.
These resolve the mode from the scope via `getActiveSnapContext()``snappingModeByContext[context]`. These resolve the mode from the scope via `getActiveSnapContext()``snappingModeByContext[context]`.
- **Modifiers.** Shift (tap) cycles the mode for the active context; Ctrl (tap) cycles the grid step; - **Modifiers.** Shift (tap) cycles the mode for the active context; Ctrl (tap) cycles the grid step;
Alt (hold) is force / free (raw cursor + commit past invalid; for MEP runs, the vertical-riser carve-out). Alt (hold) is force / free (raw cursor + commit past invalid; for MEP runs, the vertical-riser carve-out).
Shift is **not** a snap bypass and Alt is **not** a toggle. Shift is **not** a snap bypass. Alt is **not** a snap toggle. **Exception — wall/fence drafting:** those
tools have no force role (a wall/fence always places), so a clean **Alt-tap** cycles the chain mode
(`wallChainMode` room/single, `fenceChainMode` continuous/single) — wired in `hooks/use-keyboard.ts` via
`isChainModeContext()`, persisted in `useEditor`, surfaced as a clickable HUD chip. This is the one
sanctioned Alt-as-toggle, and only where Alt-as-force is meaningless.
- **The chip is the scope's.** The contextual HUD shows the active context's mode and is the only place the - **The chip is the scope's.** The contextual HUD shows the active context's mode and is the only place the
mode is cycled — so a tool that wants its chip must run inside a scope whose `snapContextOf` resolves mode is cycled — so a tool that wants its chip must run inside a scope whose `snapContextOf` resolves
(a build tool, `drafting`, `placing`/`moving`, or `reshaping`). (a build tool, `drafting`, `placing`/`moving`, or `reshaping`).
**Known-legacy (migrate on touch).** A few bespoke movers predate this model and still read **Known-legacy (migrate on touch).** Two legacy modifier patterns predate this model and survive in
`event.shiftKey` as a snap bypass with hardcoded steps: the MEP move/endpoint tools spots not yet touched; both are tracked in `plans/editor-placement-interaction-overhaul.md`. A PR that
(`packages/nodes/src/{duct-segment,pipe-segment,liquid-line,lineset,duct-fitting}/{move-tool,selection}.tsx`), **touches** one must migrate it to the model above, not extend the legacy path:
tracked in `plans/editor-placement-interaction-overhaul.md`. A PR that **touches** one must migrate it to 1. **`event.shiftKey` as a snap bypass with hardcoded steps** — the MEP move/endpoint tools
the model above, not extend the legacy path. Note: opening a `moving` scope from a bespoke mover is **not** (`packages/nodes/src/{duct-segment,pipe-segment,liquid-line,lineset,duct-fitting}/{move-tool,selection}.tsx`).
the migration — `useMovingNode()` reads the scope, so `tool-manager` re-mounts the generic Opening a `moving` scope from a bespoke mover is **not** the migration — `useMovingNode()` reads the scope,
`MoveRegistryNodeTool` alongside it (the dual-path FPS/teleport bug). Resolve the mode without a global so `tool-manager` re-mounts the generic `MoveRegistryNodeTool` alongside it (the dual-path FPS/teleport
`moving`/`reshaping` scope; see the plan's dual-path note. bug). Resolve the mode without a global `moving`/`reshaping` scope; see the plan's dual-path note.
2. **`event.altKey` as an alignment bypass** — the roof / polygon / slab pointer-move previews in
`components/editor/floorplan-panel.tsx` and the ceiling/slab `resolveSlabPlanPointSnap` / `resolveCeilingPlanPointSnap`
paths still pass `event.altKey` to suppress Figma-alignment. Alignment must instead follow the magnetic snap
mode (`bypass: !isMagneticSnapActive()`). **Already migrated (do not regress):** wall + fence drafting (3D
`{wall,fence}/tool.tsx` + the 2D `use-floorplan-background-placement.ts` / `floorplan-panel.tsx` paths), where
Alt was freed for the chain-mode toggle above.
--- ---