feat(editor): MEP placement migration — Shift=cycle / mode-driven snapping

Migrate all 9 MEP kinds' placement tools onto the unified snapping model:
declare snapProfile ('item' for point-placed hvac-equipment / duct-terminal /
duct-fitting / pipe-fitting / pipe-trap; 'structural' for directional runs
duct-segment / pipe-segment / liquid-line / lineset), and replace the legacy
shiftKey-bypass reads with mode-driven isGridSnapActive / isMagneticSnapActive /
isAngleSnapActive. For runs the 45° lock becomes the cyclable 'angles' mode;
Alt stays the vertical-riser modifier (run drafting has no validity gate to
force). Port mating gated on "mode != off". Dropped stale "⇧ smooth/free" hints.

The bespoke MEP move-tool/selection (endpoint) tools stay on the legacy model —
they use setMovingNode(null) so no moving-scope context resolves yet; migrating
them needs scope-wiring first (follow-up).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Wassim SAMAD
2026-06-25 10:56:55 -04:00
co-authored by Claude Opus 4.8
parent 76096ffe72
commit 2fdbcf03c3
18 changed files with 158 additions and 97 deletions
+9 -3
View File
@@ -1,7 +1,13 @@
'use client'
import { emitter, type GridEvent, PipeFittingNode, useScene } from '@pascal-app/core'
import { CursorSphere, EDITOR_LAYER, triggerSFX, useEditor } from '@pascal-app/editor'
import {
CursorSphere,
EDITOR_LAYER,
isGridSnapActive,
triggerSFX,
useEditor,
} from '@pascal-app/editor'
import { useViewer } from '@pascal-app/viewer'
import { Html } from '@react-three/drei'
import { useEffect, useMemo, useRef, useState } from 'react'
@@ -141,7 +147,7 @@ const PipeFittingTool = () => {
resolvePlacement(
raw,
previewNode,
useEditor.getState().gridSnapStep,
isGridSnapActive() ? useEditor.getState().gridSnapStep : 0,
manualQuatRef.current,
),
)
@@ -157,7 +163,7 @@ const PipeFittingTool = () => {
const { position, rotation } = resolvePlacement(
lastRawRef.current,
previewNode,
useEditor.getState().gridSnapStep,
isGridSnapActive() ? useEditor.getState().gridSnapStep : 0,
manualQuatRef.current,
)
const fitting = PipeFittingNode.parse({