Add path selection and rename functionality in App.tsx
This commit is contained in:
@@ -4295,6 +4295,11 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
`Selected ${BOX_VERTEX_LABELS[selection.vertexId]} on ${getBrushLabelById(selection.brushId, brushList)} from the ${source}${suffix}.`
|
`Selected ${BOX_VERTEX_LABELS[selection.vertexId]} on ${getBrushLabelById(selection.brushId, brushList)} from the ${source}${suffix}.`
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
case "paths":
|
||||||
|
setStatusMessage(
|
||||||
|
`Selected ${getPathLabelById(selection.ids[0], pathList)} from the ${source}${suffix}.`
|
||||||
|
);
|
||||||
|
break;
|
||||||
case "entities":
|
case "entities":
|
||||||
setStatusMessage(
|
setStatusMessage(
|
||||||
`Selected ${getEntityDisplayLabelById(selection.ids[0], editorState.document.entities, editorState.document.assets)} from the ${source}${suffix}.`
|
`Selected ${getEntityDisplayLabelById(selection.ids[0], editorState.document.entities, editorState.document.assets)} from the ${source}${suffix}.`
|
||||||
@@ -7880,6 +7885,35 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const applyPathNameChange = () => {
|
||||||
|
if (selectedPath === null) {
|
||||||
|
setStatusMessage("Select a path before renaming it.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nextName = normalizeScenePathName(pathNameDraft);
|
||||||
|
|
||||||
|
if (selectedPath.name === nextName) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
store.executeCommand(
|
||||||
|
createSetPathNameCommand({
|
||||||
|
pathId: selectedPath.id,
|
||||||
|
name: pathNameDraft
|
||||||
|
})
|
||||||
|
);
|
||||||
|
setStatusMessage(
|
||||||
|
nextName === undefined
|
||||||
|
? "Cleared the authored path name."
|
||||||
|
: `Renamed path to ${nextName}.`
|
||||||
|
);
|
||||||
|
} catch (error) {
|
||||||
|
setStatusMessage(getErrorMessage(error));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const applyEntityNameChange = () => {
|
const applyEntityNameChange = () => {
|
||||||
if (selectedEntity === null) {
|
if (selectedEntity === null) {
|
||||||
setStatusMessage("Select an entity before renaming it.");
|
setStatusMessage("Select an entity before renaming it.");
|
||||||
|
|||||||
Reference in New Issue
Block a user