From 857ddd4d95caf035859ffe893fb9151018fa4ccf Mon Sep 17 00:00:00 2001 From: Wassim SAMAD Date: Thu, 14 May 2026 15:05:22 -0400 Subject: [PATCH] Register 'shelf' in selection managers (5 arrays + 1 type union) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Shelf renderer was emitting `shelf:click` / `shelf:enter` / `shelf:leave` via useNodeEvents from the previous commit, but no listener subscribed — the SelectionManager components (one in editor, one in viewer) each maintain hardcoded allTypes arrays that didn't include 'shelf'. Adds 'shelf' to: - editor/selection-manager: 5 allTypes arrays (one per selection strategy — structure, structure-hover, furnish, site, deselect-also-listens-to). - viewer/selection-manager: the SelectableNodeType union + allTypes array. Shelves can now be clicked / hovered in the 3D canvas and the selection state updates correctly. The hardcoded arrays are exactly the kind of cross-cutting friction the registry is supposed to eliminate. Phase 4 should derive these lists from `nodeRegistry.entries().filter(d => d.capabilities.selectable)` so adding a new kind doesn't require editing two files. Co-Authored-By: Claude Opus 4.7 (1M context) --- packages/editor/src/components/editor/selection-manager.tsx | 5 +++++ packages/viewer/src/components/viewer/selection-manager.tsx | 2 ++ 2 files changed, 7 insertions(+) diff --git a/packages/editor/src/components/editor/selection-manager.tsx b/packages/editor/src/components/editor/selection-manager.tsx index 81a6059c..0d2c0291 100644 --- a/packages/editor/src/components/editor/selection-manager.tsx +++ b/packages/editor/src/components/editor/selection-manager.tsx @@ -576,6 +576,7 @@ const SELECTION_STRATEGIES: Record = { 'roof-segment', 'stair', 'stair-segment', + 'shelf', 'spawn', 'window', 'door', @@ -1012,6 +1013,7 @@ export const SelectionManager = () => { 'roof-segment', 'stair', 'stair-segment', + 'shelf', 'window', 'door', 'zone', @@ -1183,6 +1185,7 @@ export const SelectionManager = () => { 'roof-segment', 'stair', 'stair-segment', + 'shelf', 'spawn', 'window', 'door', @@ -1334,6 +1337,7 @@ export const SelectionManager = () => { 'roof-segment', 'stair', 'stair-segment', + 'shelf', 'spawn', 'window', 'door', @@ -1408,6 +1412,7 @@ export const SelectionManager = () => { 'roof-segment', 'stair', 'stair-segment', + 'shelf', 'spawn', 'window', 'door', diff --git a/packages/viewer/src/components/viewer/selection-manager.tsx b/packages/viewer/src/components/viewer/selection-manager.tsx index 9f7adadf..b465b3f6 100644 --- a/packages/viewer/src/components/viewer/selection-manager.tsx +++ b/packages/viewer/src/components/viewer/selection-manager.tsx @@ -35,6 +35,7 @@ type SelectableNodeType = | 'door' | 'column' | 'item' + | 'shelf' | 'slab' | 'ceiling' | 'roof' @@ -338,6 +339,7 @@ export const SelectionManager = () => { 'fence', 'item', 'column', + 'shelf', 'slab', 'ceiling', 'roof',