Skip to content

feat(nodes): draft axis guides at the moving endpoint + 2d parity#534

Merged
wass08 merged 1 commit into
mainfrom
feat/draft-axis-guides
Jul 22, 2026
Merged

feat(nodes): draft axis guides at the moving endpoint + 2d parity#534
wass08 merged 1 commit into
mainfrom
feat/draft-axis-guides

Conversation

@wass08

@wass08 wass08 commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

What

While drafting a wall or fence segment (click start → move endpoint):

  • 3D walls: the moving endpoint now shows a long guide line perpendicular to the draft segment, in addition to the existing X/Z axis cross at the start point. (A full cross at the endpoint was considered and rejected — it collides with the start cross whenever the segment is axis-aligned.)
  • 3D fences: gains the same guides — fences previously had no axis guides at all.
  • 2D floor plan: renders the equivalent guides in SVG — cross through the draft start, perpendicular line through the moving endpoint — fed by useFloorplanDraftPreview, for both wall and fence drafts.

How

  • The guide pieces (axis cross, perpendicular end line, axis-angle arc + measurement label) are extracted from wall/tool.tsx into packages/nodes/src/shared/draft-axis-guides.tsx; DraftAxisGuideState gains endOrigin.
  • fence/tool.tsx drops its duplicated DraftAngleArc/DraftMeasurementLabel copies in favor of the shared module and wires up the new axisGuide state.
  • 2D guides render in FloorplanLinearDraftLayer (the leaf layer that already re-renders per move) as solid lines with stroke width budgeted via unitsPerPixel, matching the alignment-guide layer — dashed 2000 m lines were too expensive.

Verification

  • check-types 9/9, @pascal-app/nodes tests 874 pass, biome clean.
  • Manually verified in the editor: wall + fence drafts in 3D and in the 2D floor plan.

Note

Low Risk
Editor-only drafting visuals and a refactor of duplicated UI helpers; no persistence, auth, or core geometry commit paths changed.

Overview
Adds draft axis guides while drawing wall and fence segments: an axis cross at the start point and a perpendicular guide through the moving endpoint (no second full cross at the end, to avoid overlap on axis-aligned segments).

3D: Wall and fence tools share a new packages/nodes/src/shared/draft-axis-guides.tsx module (DraftAxisGuides, getNearestAxisAngleLabel, measurement/arc UI). DraftAxisGuideState now includes endOrigin so the end perpendicular line renders during drag. Fence tool wires up the same axisGuide flow it lacked before; duplicated local DraftAngleArc / DraftMeasurementLabel code is removed.

2D: The floor plan panel draws matching SVG guides for active wall and fence drafts from useFloorplanDraftPreview, using long solid lines and unitsPerPixel stroke width for performance.

Reviewed by Cursor Bugbot for commit 879bf6e. Bugbot is set up for automated code reviews on this repo. Configure here.

Wall/fence drafting already drew an X/Z axis cross at the segment start.
Now the moving endpoint gets a single long guide line perpendicular to the
draft segment (a second cross would collide with the start cross on
axis-aligned segments), fences gain the same guides they lacked entirely,
and the 2D floor plan renders the equivalent SVG guides (cross at start,
perpendicular line at end) fed by the floorplan draft preview store.

The guide components are extracted from wall/tool.tsx into
nodes/shared/draft-axis-guides.tsx so both tools (and the fence's formerly
duplicated arc/label helpers) share one implementation.
@wass08
wass08 merged commit 26c9e17 into main Jul 22, 2026
2 checks passed

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 879bf6e. Configure here.

y1: end[1] - ny * DRAFT_AXIS_GUIDE_EXTENT,
x2: end[0] + nx * DRAFT_AXIS_GUIDE_EXTENT,
y2: end[1] + ny * DRAFT_AXIS_GUIDE_EXTENT,
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2D endpoint guide length mismatch

Medium Severity

The 2D draft axis guide draws its endpoint perpendicular line for segments as short as 1e-6 m. This is inconsistent with 3D DraftAxisGuides and wall previews, which require segments of at least 0.01 m, leading to a misleading 2D guide for very short drafts without a corresponding 3D visual.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 879bf6e. Configure here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant