Skip to content

editor: improve floorplan navigation performance#541

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

editor: improve floorplan navigation performance#541
wass08 merged 32 commits into
pascalorg:mainfrom
sudhir9297:floor-plan-fix

Conversation

@sudhir9297

@sudhir9297 sudhir9297 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

  • Keeps annotation collision/layout work off active pan, zoom, and rotation frames, then coalesces the final settled layout pass.
  • Moves navigation pose updates away from broad event-bus/React subscriptions into selector-based transient stores.
  • Updates cached label DOM references imperatively, ignores rotation changes below 1°, and avoids floorplan work while only the 3D view is visible.
  • Preserves the existing 2D/3D camera synchronization and does not change 3D renderer behavior.

How to test

  1. Run bun run check, bun run check-types, and bun run build.
  2. Run bun run dev, open a heavy scene in 2D or split view, then pan, zoom, and rotate; verify navigation stays responsive and labels settle readable with a white background.
  3. Switch to 3D-only view, move the camera, then return to the floorplan; verify camera synchronization still works without continuous hidden floorplan updates.

Screenshots / screen recording

Not included yet — this is a performance-focused interaction change; a recording can be added during review.

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 2D/3D camera synchronization and large floorplan interaction paths; behavior is heavily unit-tested but regressions would show as desynced views or label layout glitches.

Overview
Improves floorplan pan/zoom/rotate responsiveness by doing less work on every frame while keeping 2D/3D camera alignment.

2D/3D camera sync moves out of custom-camera-controls: the 3D camera now publishes poses through a camera pose store instead of camera-controls:pose / per-frame navigationSyncPose echo logic. A new floorplan-camera-sync bridge converts poses, suppresses tiny updates and sub-degree rotation noise, skips sync in 3D-only mode, and applies 2D poses via camera-controls:apply-pose. The floorplan panel consumes navigation through a transient channel plus createFloorplanNavigationSyncScheduler, which drives imperative SVG during motion and commits React viewport state only after the stream settles.

Annotation layout replaces the SVG MutationObserver with subscriptions to scene/transform/override changes (rAF-coalesced). Rotation-only scene changes update label transforms imperatively (new label data-* + updateSvgFloorplanLabelOrientations) without rerunning collision layout; full collision passes use cached label node lists. FloorplanRenderProvider splits context so zoom scale can update via a stable getUnitsPerPixel reader without churning registry consumers.

Navigation sync pose writes also go through a small navigation sync pose store for selector-based subscribers alongside use-editor state.

Reviewed by Cursor Bugbot for commit 999baaa. 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 3 potential issues.

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 999baaa. Configure here.

return
}
if (latestCameraPose) publishCameraNavigationPose(latestCameraPose)
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Align-north ignored in 3D-only

High Severity

When in 3D view, the FloorplanCameraSyncBridge is inactive and drops incoming 2D navigation poses. This prevents the 3D camera from updating for actions like 'align-to-north', causing a desync where the compass animates but the camera stays put. Any pending 2D poses are never applied, leading to stale camera state.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 999baaa. Configure here.

bridgeRef.current = createFloorplanCameraSyncBridge({
active,
applyCameraPose: (pose) => emitter.emit('camera-controls:apply-pose', pose),
publishNavigationPose: (pose) => liveCameraNavigation.publish(pose),

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Export loses 3D camera azimuth

Medium Severity

Floorplan PDF exports show outdated camera rotation because live 3D navigation updates are published to liveCameraNavigation but don't update useEditor.navigationSyncPose, which the export relies on. This occurs after orbiting or panning in 3D or split view.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 999baaa. Configure here.

layoutOverrides: annotationLayoutOverrides,
})
setPreflightIssues(preflightIssues)
appliedLayoutInputsRef.current = layoutInputs

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Zoom skips annotation collision layout

High Severity

The new annotation layout system in FloorplanAnnotationLayoutResolver doesn't react to viewport scale changes. After zooming, label plates, handle sizes, and collision offsets can become stale, causing incorrect collision resolution and overlapping labels.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 999baaa. Configure here.

@wass08
wass08 merged commit 3b70deb into pascalorg:main Jul 24, 2026
3 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