Add view mode handling in App.tsx

This commit is contained in:
2026-04-02 22:16:59 +02:00
parent 73efd566f4
commit 9eaf60f5e6

View File

@@ -717,6 +717,7 @@ function formatAdvancedRenderingToneMappingLabel(mode: AdvancedRenderingToneMapp
export function App({ store, initialStatusMessage }: AppProps) {
const editorState = useEditorStoreState(store);
const brushList = Object.values(editorState.document.brushes);
const viewMode = editorState.viewportViewMode;
const entityList = getEntityInstances(editorState.document.entities);
const entityDisplayList = getSortedEntityDisplayLabels(editorState.document.entities, editorState.document.assets);
const primaryPlayerStart = getPrimaryPlayerStartEntity(editorState.document.entities);
@@ -1277,6 +1278,16 @@ export function App({ store, initialStatusMessage }: AppProps) {
}
};
const handleSetViewportViewMode = (nextViewMode: ViewportViewMode) => {
if (editorState.viewportViewMode === nextViewMode) {
return;
}
blurActiveTextEntry();
store.setViewportViewMode(nextViewMode);
setStatusMessage(`Switched the viewport to ${getViewportViewModeLabel(nextViewMode)} view.`);
};
const handleCreateBoxBrush = (center?: Vec3) => {
try {
store.executeCommand(createCreateBoxBrushCommand(center === undefined ? {} : { center }));