From 95645d8e37839f574d43adc1fa17d9e53b3aa80c Mon Sep 17 00:00:00 2001 From: Wassim SAMAD Date: Fri, 15 May 2026 17:03:22 -0400 Subject: [PATCH] SelectionManager: route furnish-category registry kinds through furnish phase Shelf clicks in 3D weren't selecting: getSelectionTarget routed shelf (category='furnish') to the furnish phase, but furnish.isValid hard- coded `node.type !== 'item'` and rejected shelf. Click switched phase, nothing selected. Fix: extend furnish.isValid to also accept registry-driven kinds whose def.category === 'furnish' AND def.capabilities.selectable. Item's asset.category door/window special-case stays first. Future furnish-category kinds (tables, lamps, etc.) are selectable in furnish phase without further changes. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../src/components/editor/selection-manager.tsx | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/editor/src/components/editor/selection-manager.tsx b/packages/editor/src/components/editor/selection-manager.tsx index 23d0ecbf..4f067795 100644 --- a/packages/editor/src/components/editor/selection-manager.tsx +++ b/packages/editor/src/components/editor/selection-manager.tsx @@ -684,9 +684,19 @@ const SELECTION_STRATEGIES: Record = { }, isValid: (node) => { if (!isNodeInCurrentLevel(node)) return false - if (node.type !== 'item') return false - const item = node as ItemNode - return item.asset.category !== 'door' && item.asset.category !== 'window' + // Item: door/window-category items belong to structure phase, not furnish. + if (node.type === 'item') { + const item = node as ItemNode + return item.asset.category !== 'door' && item.asset.category !== 'window' + } + // Registry-driven kinds with `category: 'furnish'` (shelf today, + // future furniture kinds): selectable in furnish phase if their + // definition declares the `selectable` capability. Without this + // branch, shelf clicks routed to furnish phase via getSelectionTarget + // would be rejected here — single-click selection broken. + const def = nodeRegistry.get(node.type) + if (def && def.category === 'furnish' && def.capabilities.selectable) return true + return false }, }, }