From 2eef503c498be0cc8dea2ba70a5a878bca0423f8 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Wed, 15 Apr 2026 14:51:30 +0200 Subject: [PATCH] Add function to get multi-selection summary in App.tsx --- src/app/App.tsx | 79 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) diff --git a/src/app/App.tsx b/src/app/App.tsx index 4d41138f..2f909637 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -1330,6 +1330,85 @@ function describeSelection( } } +function getMultiSelectionSummary( + selection: EditorSelection, + activeSelectionId: string | null, + brushes: Brush[], + modelInstances: Record, + assets: Record, + entities: Record +): + | { + kindLabel: string; + count: number; + activeId: string; + activeLabel: string; + selectedLabels: string[]; + } + | null { + const resolvedActiveSelectionId = resolveSelectionActiveId( + selection, + activeSelectionId + ); + + if (resolvedActiveSelectionId === null) { + return null; + } + + switch (selection.kind) { + case "brushes": + if (selection.ids.length <= 1) { + return null; + } + + return { + kindLabel: "Whitebox Solids", + count: selection.ids.length, + activeId: resolvedActiveSelectionId, + activeLabel: getBrushLabelById(resolvedActiveSelectionId, brushes), + selectedLabels: selection.ids.map((id) => getBrushLabelById(id, brushes)) + }; + case "entities": + if (selection.ids.length <= 1) { + return null; + } + + return { + kindLabel: "Entities", + count: selection.ids.length, + activeId: resolvedActiveSelectionId, + activeLabel: getEntityDisplayLabelById( + resolvedActiveSelectionId, + entities, + assets + ), + selectedLabels: selection.ids.map((id) => + getEntityDisplayLabelById(id, entities, assets) + ) + }; + case "modelInstances": + if (selection.ids.length <= 1) { + return null; + } + + return { + kindLabel: "Model Instances", + count: selection.ids.length, + activeId: resolvedActiveSelectionId, + activeLabel: getModelInstanceDisplayLabelById( + resolvedActiveSelectionId, + modelInstances, + assets + ), + selectedLabels: selection.ids.map((id) => + getModelInstanceDisplayLabelById(id, modelInstances, assets) + ) + }; + default: + return null; + } +} + function getWhiteboxSelectionModeStatus(mode: WhiteboxSelectionMode): string { switch (mode) { case "object":