Skip to content

editor: fix roof and placement previews - #718

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

editor: fix roof and placement previews#718
sudhir9297 wants to merge 46 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

High Risk
Touches roof schema, scene migration, CSG/dormer geometry, and placement raycasting—areas that affect saved scenes and structural editing correctness.

Overview
Adds conical as a roof segment type with mesh/surface/print support, optional RoofNode.support for level vs roof-surface mounting, and resolveConicalRoofPlacement (auto / ground / roof). The roof tool draws circular footprints, cycles placement with P, and tints ghosts when roof-only placement fails.

Dormers move from inline parametric windows to WindowNode children on wall faces (with scene load migration and sidebar tree expansion). CSG and cuts use hosted window geometry; shedHighSide controls shed pitch direction.

Lean-to schema grows richer hosting (hostKind, slab edges, conical base), omittedPostSlots when managed posts are deleted, and handle connectionSnap (Alt bypass) for structural edge joining. Roof overlap logic treats mounted conicals so hosts clip towers in plan.

Editor / UX: orthographic pointer rays no longer drift off-cursor; item placement rotation stays aligned on parent-hosted surfaces; registry tools get isCameraDragging and a wider RegistryToolProvider; read-only scenes hide mutating chrome; Delete mode removes floorplan picks; Build tab roof-feature tiles only highlight the matching accessory (not the plain roof tool). Keyboard R/T defer to lean-to and item placement tools.

Reviewed by Cursor Bugbot for commit 1f790d3. 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>

@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 2 potential issues.

Fix All in Cursor

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

Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.

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

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.

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