Add functions to handle edge and vertex selection in App.tsx
This commit is contained in:
@@ -613,6 +613,16 @@ function getSelectedBrushLabel(selection: EditorSelection, brushes: BoxBrush[]):
|
|||||||
return getBrushLabelById(selectedBrushId, brushes);
|
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(
|
function describeSelection(
|
||||||
selection: EditorSelection,
|
selection: EditorSelection,
|
||||||
brushes: BoxBrush[],
|
brushes: BoxBrush[],
|
||||||
@@ -627,6 +637,10 @@ function describeSelection(
|
|||||||
return `${selection.ids.length} solid${selection.ids.length === 1 ? "" : "s"} selected (${getSelectedBrushLabel(selection, brushes)})`;
|
return `${selection.ids.length} solid${selection.ids.length === 1 ? "" : "s"} selected (${getSelectedBrushLabel(selection, brushes)})`;
|
||||||
case "brushFace":
|
case "brushFace":
|
||||||
return `1 face selected (${BOX_FACE_LABELS[selection.faceId]} on ${getBrushLabelById(selection.brushId, brushes)})`;
|
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":
|
case "entities":
|
||||||
return `${selection.ids.length} entity selected (${getEntityDisplayLabelById(selection.ids[0], entities, assets)})`;
|
return `${selection.ids.length} entity selected (${getEntityDisplayLabelById(selection.ids[0], entities, assets)})`;
|
||||||
case "modelInstances":
|
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 {
|
function getInteractionTriggerLabel(trigger: InteractionTriggerKind): string {
|
||||||
switch (trigger) {
|
switch (trigger) {
|
||||||
case "enter":
|
case "enter":
|
||||||
|
|||||||
Reference in New Issue
Block a user