From ac14443fa67ce134c0ec04b9da00f9673d363143 Mon Sep 17 00:00:00 2001 From: Wassim SAMAD Date: Thu, 25 Jun 2026 14:46:16 -0400 Subject: [PATCH] fix(editor): polygon vertex/edge edit honors the active snapping mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The shared polygon-vertex affordance snapped via snapPointToGrid(rawPoint), whose default step is the hardcoded WALL_GRID_STEP (0.5m) — so slab/zone/ceiling vertex, edge, and add-vertex edits always quantized to half-meters regardless of the active mode OR the user's grid-step setting (plan open bugs #1-2). Use the mode-aware getSegmentGridStep() (0 in non-grid modes) so grid quantizes to the live step, lines/off pass through to the wall-snap/alignment resolver. Drop the legacy shiftKey bypass from the slab/ceiling magnetic resolvers (they already gate on isMagneticSnapActive). Co-Authored-By: Claude Opus 4.8 --- .../src/ceiling/floorplan-affordances.ts | 3 +- .../src/shared/polygon-vertex-affordance.ts | 32 +++++++++++++------ .../nodes/src/slab/floorplan-affordances.ts | 3 +- 3 files changed, 27 insertions(+), 11 deletions(-) diff --git a/packages/nodes/src/ceiling/floorplan-affordances.ts b/packages/nodes/src/ceiling/floorplan-affordances.ts index d1802097..693f6a55 100644 --- a/packages/nodes/src/ceiling/floorplan-affordances.ts +++ b/packages/nodes/src/ceiling/floorplan-affordances.ts @@ -28,8 +28,9 @@ const ceilingSnapOptions = { levelId: resolveLevelId(node, sceneNodes), excludeId: node.id, nodes: sceneNodes, + // Magnetic wall-snap/alignment gates on `isMagneticSnapActive()` (the + // `lines` mode), so no Shift bypass — Alt still force-skips alignment. altKey: modifiers.altKey, - shiftKey: modifiers.shiftKey, }).point }, } diff --git a/packages/nodes/src/shared/polygon-vertex-affordance.ts b/packages/nodes/src/shared/polygon-vertex-affordance.ts index cf2e803e..4af2ce81 100644 --- a/packages/nodes/src/shared/polygon-vertex-affordance.ts +++ b/packages/nodes/src/shared/polygon-vertex-affordance.ts @@ -6,7 +6,12 @@ import { type FloorplanAffordanceSession, useScene, } from '@pascal-app/core' -import { snapPointToGrid, type WallPlanPoint } from '@pascal-app/editor' +import { + getSegmentGridStep, + snapPointToGrid, + snapScalarToGrid, + type WallPlanPoint, +} from '@pascal-app/editor' /** * Shared "edit polygon" floor-plan affordances. Used by kinds whose @@ -123,7 +128,11 @@ export function createPolygonVertexAffordance