Skip to content

editor: fix roof and placement previews - #718

Open
sudhir9297 wants to merge 49 commits into
pascalorg:mainfrom
sudhir9297:t3code/understand-roof-improvement-system
Open

editor: fix roof and placement previews#718
sudhir9297 wants to merge 49 commits into
pascalorg:mainfrom
sudhir9297:t3code/understand-roof-improvement-system

Conversation

@sudhir9297

@sudhir9297 sudhir9297 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Improves roof, dormer, lean-to, and window placement so cursor rays, ghosts, and committed items resolve to the exact pointer location, including centered freestanding lean-to placement. Transient placement previews now use live overrides during pointer movement, snapping follows the active mode, and shared helpers stay within the correct architecture boundaries.

How to test

  1. Run bun run check and bun run check-types.
  2. Run the focused tests with bun test packages/nodes/src/lean-to-extension packages/nodes/src/dormer packages/nodes/src/window packages/editor/src/components/tools/shared/pointer-support-cap.test.ts.
  3. Run bun dev, place and move a freestanding lean-to, dormer window, wall window, and roof-face window; confirm the ghost and final item stay centered under the cursor and follow the same raycast position.
  4. Confirm the lean-to footprint remains centered after rotation and movement, and that grid/line/off snapping modes behave consistently.

The package builds for core, nodes, and viewer pass. The full app production build is currently blocked by the unchanged react-scan dependency's webpack export mismatch; Turbopack also hits an environment process-permission error.

Screenshots / screen recording

Not included — visual verification should be performed with the interactive placement steps above.

Checklist

  • I've tested this locally with bun dev
  • My code follows the existing code style (run bun check to verify)
  • I've updated relevant documentation (if applicable)
  • This PR targets the main branch

Note

Medium Risk
Large changes to roof schema, scene migration, placement raycasting, and overlap logic affect how structures are created and cloned; regressions would show up as wrong footprints, mounts, or previews rather than security issues.

Overview
Adds conical as a roof type with sector geometry, surface-height sampling, optional roof-surface mounting (RoofSupport), and overlap rules so host roofs clip mounted cones. The standalone Build tab roof panel now picks roof type, footprint from (room / curved wall / draw), and still lists feature tiles; selecting a curved wall under conical+wall can spawn a matching sector and select it.

The roof tool commits footprints from enclosed rooms (with elevation from enclosing walls), drawn rectangles or diameters, and curved-wall clicks for conical sectors; conical draw uses auto / ground / roof placement (P to cycle) with colored ghosts. Dormers migrate legacy inline windows to hosted WindowNode children with face-local placement helpers.

Editor polish bundled here: orthographic pointer rays stay on the cursor line for top-surface picking; item rotation during placement updates live overrides and floor-plan preview together; linear handles gain connectionSnap (Alt bypasses); portalTarget / optional visible on handles; polygon union no longer stitches point-touching branches into bad rings; read-only scenes hide editing chrome; dormer sidebar trees expand to window children. Root checks script runs biome + types.

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

sudhir9297 and others added 30 commits May 19, 2026 02:59
Items (e.g. solar panels) can now be placed on sloped roof surfaces.
The placement system computes euler rotation from the roof surface
normal so items sit flush on the slope instead of going inside.

- Add roofStrategy to placement-strategies with enter/move/click/leave
- Wire roof:enter/move/click/leave events in the placement coordinator
- Add calculateRoofRotation in placement-math using surface normals
- Support full 3D cursor rotation for sloped surfaces
- Items on roofs are parented to the level with world-space rotation

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
useViewer.setState({ hoveredId: null })
}
return
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Delete mode blocked by move

High Severity

Delete handling was moved into emitCanvasNodeSelection, but the existing click-to-move early return still runs first. In delete mode, clicking an already-selected movable node picks it up for move and returns before delete can run, so that click never removes the node.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1f790d3. Configure here.

editor.tool === 'item' ||
editor.tool === 'lean-to-extension')
)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Lean-to move double rotation

Medium Severity

isToolOwnedRotation now stands down for lean-to placement, and for moving doors, windows, and items, but not for a moving lean-to-extension. The registry move tool still handles R/T, so a lean-to move with an active selection can apply both the global and move-tool rotations.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 1f790d3. Configure here.

@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.

There are 3 total unresolved issues (including 2 from previous reviews).

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 0ed0424. Configure here.

mode,
selectedCurvedWall,
setSelection,
])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Duplicate roofs on wall reselect

High Severity

In conical wall-footprint mode, selecting a curved wall always calls createConicalRoofSectorAboveWall whenever the selection is that wall. After creation the selection moves to the new segment and conicalSourceRef clears, so clicking or reselecting the same wall creates another identical roof with no idempotency check.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0ed0424. 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