Add functions to handle edge and vertex selection in App.tsx

This commit is contained in:
2026-04-04 20:12:45 +02:00
parent 72a204761f
commit 0082dd4b52

View File

@@ -613,6 +613,16 @@ function getSelectedBrushLabel(selection: EditorSelection, brushes: BoxBrush[]):
return getBrushLabelById(selectedBrushId, brushes);
}
function getSelectedBrushEdgeLabel(selection: EditorSelection): string | null {
const selectedEdgeId = getSelectedBrushEdgeId(selection);
return selectedEdgeId === null ? null : BOX_EDGE_LABELS[selectedEdgeId];
}
function getSelectedBrushVertexLabel(selection: EditorSelection): string | null {
const selectedVertexId = getSelectedBrushVertexId(selection);
return selectedVertexId === null ? null : BOX_VERTEX_LABELS[selectedVertexId];
}
function describeSelection(
selection: EditorSelection,
brushes: BoxBrush[],
@@ -627,6 +637,10 @@ function describeSelection(
return `${selection.ids.length} solid${selection.ids.length === 1 ? "" : "s"} selected (${getSelectedBrushLabel(selection, brushes)})`;
case "brushFace":
return `1 face selected (${BOX_FACE_LABELS[selection.faceId]} on ${getBrushLabelById(selection.brushId, brushes)})`;
case "brushEdge":
return `1 edge selected (${BOX_EDGE_LABELS[selection.edgeId]} on ${getBrushLabelById(selection.brushId, brushes)})`;
case "brushVertex":
return `1 vertex selected (${BOX_VERTEX_LABELS[selection.vertexId]} on ${getBrushLabelById(selection.brushId, brushes)})`;
case "entities":
return `${selection.ids.length} entity selected (${getEntityDisplayLabelById(selection.ids[0], entities, assets)})`;
case "modelInstances":
@@ -636,6 +650,19 @@ function describeSelection(
}
}
function getWhiteboxSelectionModeStatus(mode: WhiteboxSelectionMode): string {
switch (mode) {
case "object":
return "Whitebox selection mode set to Object. Whole-solid transforms are available.";
case "face":
return "Whitebox selection mode set to Face. Click a face to edit materials and UVs.";
case "edge":
return "Whitebox selection mode set to Edge. Edge transforms land in the next slice.";
case "vertex":
return "Whitebox selection mode set to Vertex. Vertex transforms land in the next slice.";
}
}
function getInteractionTriggerLabel(trigger: InteractionTriggerKind): string {
switch (trigger) {
case "enter":