registry: post-migration polish — ceiling 3D selection, ceiling item commit, floorplan move drift

Three bugs surfaced after the Stage E node-registry migration:

1. Ceiling intercepts 3D hover/click selection
   Selecting via the floor-plan helper or the boundary-editor handles
   is the intended flow; a direct 3D click on the ceiling should fall
   through to whatever's underneath. `SelectionManager` now early-returns
   on `ceiling` in onEnter/onLeave/onClick, so `event.stopPropagation`
   is skipped and the ray reaches the item/wall/floor below.

2. Ceiling item placement: final click does nothing
   When a ceiling-attached draft hangs in front of the ceiling-grid
   mesh, the click ray hits the draft first and fires `item:click`,
   not `ceiling:click`. `onItemClick` already forwards self-clicks to
   shelf-surface / item-surface hosts; this PR adds the matching
   ceiling branch so the commit lands on the ceiling under the cursor.

3. Floor-plan item move drift after the commit click
   Two contributing causes, both fixed:

   - `usePlacementCoordinator`'s `useFrame` lerped the draft mesh
     toward `gridPosition.current` (the item's pre-move spot) every
     frame, fighting React's render from `scene.position` while the
     2D `FloorplanRegistryMoveOverlay` drove the move. Gated the lerp
     on a `has3DPointerDrivenMoveRef` flag set on first 3D pointer
     event — pure 3D drags are unchanged.
   - The overlay's pointer-up handler skipped a final `session.apply`
     and committed at the last pointermove position. Browsers don't
     guarantee a pointermove right before pointerup, so a quick click
     after a drag could land a few pixels off. Re-apply at pointer-up
     coords so commit matches where the user actually released.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Wassim SAMAD
2026-05-19 17:32:11 -04:00
co-authored by Claude Opus 4.7
parent d747d2f0ea
commit 1ec65acc5f
3 changed files with 86 additions and 0 deletions
@@ -304,6 +304,11 @@ export const SelectionManager = () => {
const onEnter = (event: NodeEvent) => {
const strategy = getStrategy()
if (!strategy) return
// Ceilings are selected via their floor-plan helper and the
// boundary-editor vertex handles, never via a direct 3D click on
// the polygon. Skipping selection routing here means a click on a
// ceiling falls through to the item / wall / floor below it.
if (event.node.type === 'ceiling') return
if (strategy.isValid(event.node)) {
event.stopPropagation()
if (event.node.type === 'slab') {
@@ -317,6 +322,7 @@ export const SelectionManager = () => {
const onLeave = (event: NodeEvent) => {
const strategy = getStrategy()
if (!strategy) return
if (event.node.type === 'ceiling') return
if (strategy.isValid(event.node)) {
event.stopPropagation()
useViewer.setState({ hoveredId: null })
@@ -326,6 +332,7 @@ export const SelectionManager = () => {
const onClick = (event: NodeEvent) => {
const strategy = getStrategy()
if (!strategy) return
if (event.node.type === 'ceiling') return
if (!strategy.isValid(event.node)) return
event.stopPropagation()