Skip to content

editor: stabilize floorplan and camera interactions#545

Merged
wass08 merged 35 commits into
pascalorg:mainfrom
sudhir9297:floor-plan-hot-fix
Jul 24, 2026
Merged

editor: stabilize floorplan and camera interactions#545
wass08 merged 35 commits into
pascalorg:mainfrom
sudhir9297:floor-plan-hot-fix

Conversation

@sudhir9297

@sudhir9297 sudhir9297 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Keeps selected-object outlines visible while orbiting, panning, or zooming the 3D camera.
  • Prevents the rotated 2D floor plan from exposing white cutouts or clipping the grid and drawing.
  • Synchronizes the 2D floor-plan rotation, 3D camera, and compass from initial load in either direction without waiting for unrelated pointer movement or introducing camera jumps.
  • Persists wall center-handle curve edits and prevents stale green curve-handle state when entering split view.
  • Keeps zoom-scale subscriptions below the floor-plan registry-entry boundary and documents reshape interaction ownership.

How to test

  1. Select an object in 3D, then orbit, pan, and zoom; confirm its outline remains continuously visible.
  2. Draw walls in 2D, zoom out, and rotate the floor plan; confirm the grid and drawing fill the viewport without white clipped corners.
  3. Reload directly into 2D, rotate the floor plan, and confirm the 3D camera and compass update immediately without first interacting with 3D.
  4. Rotate the 3D camera first, then rotate in 2D; confirm both views and the compass remain synchronized without a release-time snap or camera jump.
  5. Select a wall, drag its center handle to create a curve, and release; confirm the curve remains committed.
  6. With a wall selected, switch from 3D to split view; confirm no stale green center-handle artifact appears.
  7. Run bun test packages/editor/src/components/editor-2d/floorplan-render-context.test.ts packages/editor/src/components/editor-2d/renderers/floorplan-registry-layer.test.ts packages/editor/src/store/use-interaction-scope.test.ts packages/nodes/src/wall/floorplan-affordances.test.ts.
  8. Run bun run check-types, bun run check, and bun run build.

Screenshots / screen recording

To be added — this PR contains visual and interactive editor fixes.

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
Touches interaction scope, floor plan navigation/camera sync, and rendering paths used on every edit; regressions could affect reshape tools, split view, or 2D/3D camera alignment.

Overview
Improves 2D floor plan rotation and 2D↔3D navigation so the compass and camera stay aligned from first load, including sub-degree headings and live updates while the floor plan panel is hidden. Camera pose publishing now runs on initial mount and when programmatic interpolation ends, and the sync bridge no longer quantizes azimuth to whole degrees or defers 3D→2D heading until the panel is visible.

Rotation presentation uses an overscan view box and larger background rect so rotated plans do not show white corners; the SVG allows overflow, compass rotation is driven imperatively each frame, and CSS transform preview is cleared only after React commits rotation state.

Interaction scope gains a driver on reshaping (tool vs floorplan). Floor plan affordances set floorplan so ToolManager skips duplicate 3D boundary/endpoint/curve tools during 2D handle drags; wall curve commits are covered by a new affordance test.

Floor plan zoom scale is exposed via subscribe + useFloorplanStaticUnitsPerPixel (useSyncExternalStore), with scale updates in useLayoutEffect, so handle radii and overlays re-render when zoom changes without prop-drilling unitsPerPixel through registry entries.

Viewer: merged outline pass no longer disables during camera dragging, so selection outlines stay visible while orbiting/panning/zooming.

Reviewed by Cursor Bugbot for commit bc86bdd. 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>
Stream live headings in 2D and 3D, and defer restoring the compositor rotation preview until the committed floor-plan state is ready to paint so pointer release cannot snap back.

@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 bc86bdd. Configure here.


useLayoutEffect(() => {
flushFloorplanRotationPresentationRestore(pendingFloorplanRotationRestoreRef)
})

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Rotation restore needs re-render

Medium Severity

Replacing synchronous SVG transform cleanup in commitFloorplanRotation with queueFloorplanRotationPresentationRestore plus a layout-effect flush means the preview transform is only cleared when React re-renders. If both setFloorplanUserRotationDeg and setViewport no-op because values are unchanged, no render runs and the queued restore never flushes, leaving compositor rotation styles on the SVG.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit bc86bdd. Configure here.

@wass08
wass08 merged commit 7309fc8 into pascalorg:main Jul 24, 2026
2 checks passed
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.

2 participants