feat(editor): MEP move-tools — mode-driven snapping (drop Shift=bypass)

The 5 bespoke MEP movers (duct/pipe-segment, liquid-line, lineset, duct-fitting)
now read the active snapping mode (isGridSnapActive / isMagneticSnapActive)
instead of shiftKey=bypass. The moving scope already carries the node
(setMovingNode → begin('moving')), so the per-kind context resolves with no
extra wiring. Grid and alignment are now independent reads.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Wassim SAMAD
2026-06-25 12:06:31 -04:00
co-authored by Claude Opus 4.8
parent 2fdbcf03c3
commit 8e9a45a9d5
5 changed files with 44 additions and 30 deletions
+12 -6
View File
@@ -13,6 +13,8 @@ import {
import {
DragBoundingBox,
EDITOR_LAYER,
isGridSnapActive,
isMagneticSnapActive,
markToolCancelConsumed,
stripPlacementMetadataFlags,
triggerSFX,
@@ -177,14 +179,14 @@ export const MoveDuctFittingTool: React.FC<{ node: AnyNode }> = ({ node }) => {
let lastPos: Vec3 = originalPosition
const onMove = (event: GridEvent) => {
const bypass = event.nativeEvent?.shiftKey === true
const snap = bypass ? (v: number) => v : snapToGridStep
const snap = isGridSnapActive() ? snapToGridStep : (v: number) => v
let x = snap(event.localPosition[0])
let z = snap(event.localPosition[2])
// Alignment: snap the footprint box edges onto nearby geometry and
// publish guides (Alt / Shift bypass).
if (!bypass) {
// Magnetic alignment: snap the footprint box edges onto nearby geometry
// and publish guides. Grid follows the snapping mode; lines follow
// magnetic alignment — the two are independent.
if (isMagneticSnapActive()) {
const proposed: Aabb2D = {
minX: x + ox - hx,
maxX: x + ox + hx,
@@ -200,7 +202,11 @@ export const MoveDuctFittingTool: React.FC<{ node: AnyNode }> = ({ node }) => {
}
const next: Vec3 = [x, originalPosition[1], z]
if (next[0] !== lastPos[0] || next[2] !== lastPos[2]) triggerSFX('sfx:grid-snap')
if (
(isGridSnapActive() || isMagneticSnapActive()) &&
(next[0] !== lastPos[0] || next[2] !== lastPos[2])
)
triggerSFX('sfx:grid-snap')
lastPos = next
hasMoved = true
setCursorPos(next)