diff --git a/src/app/App.tsx b/src/app/App.tsx index 23311b17..9e7397f9 100644 --- a/src/app/App.tsx +++ b/src/app/App.tsx @@ -205,24 +205,17 @@ function formatDiagnosticCount(count: number, label: string): string { function getViewportCaption( toolMode: "select" | "box-create" | "play", - layoutMode: ViewportLayoutMode, - activePanelId: ViewportPanelId, - activePanelState: { viewMode: ViewportViewMode; displayMode: ViewportDisplayMode }, - brushCount: number + layoutMode: ViewportLayoutMode ): string { if (toolMode === "play") { return "Runner is active."; } - const layoutLabel = getViewportLayoutModeLabel(layoutMode); - const panelLabel = getViewportPanelLabel(activePanelId); - const panelSummary = `${getViewportViewModeLabel(activePanelState.viewMode)} / ${getViewportDisplayModeLabel(activePanelState.displayMode)}`; - if (toolMode === "box-create") { - return `${brushCount} box brush${brushCount === 1 ? "" : "es"} loaded. ${layoutLabel} active. Box Create uses the active panel. Active panel: ${panelLabel} (${panelSummary}).`; + return `${getViewportLayoutModeLabel(layoutMode)} active. Hover any viewport to update the shared preview; click to place.`; } - return `${brushCount} box brush${brushCount === 1 ? "" : "es"} loaded. ${layoutLabel} active. Active panel: ${panelLabel} (${panelSummary}).`; + return `${getViewportLayoutModeLabel(layoutMode)} active.`; } function createVec2Draft(vector: Vec2): Vec2Draft { @@ -736,6 +729,7 @@ export function App({ store, initialStatusMessage }: AppProps) { const activePanelState = editorState.viewportPanels[activePanelId]; const activePanelLabel = getViewportPanelLabel(activePanelId); const activePanelDisplaySummary = `${getViewportViewModeLabel(activePanelState.viewMode)} / ${getViewportDisplayModeLabel(activePanelState.displayMode)}`; + const viewportToolPreview = editorState.viewportTransientState.toolPreview; const entityList = getEntityInstances(editorState.document.entities); const entityDisplayList = getSortedEntityDisplayLabels(editorState.document.entities, editorState.document.assets); const primaryPlayerStart = getPrimaryPlayerStartEntity(editorState.document.entities); @@ -1304,6 +1298,14 @@ export function App({ store, initialStatusMessage }: AppProps) { return; } + if ( + nextLayoutMode === "single" && + editorState.viewportTransientState.toolPreview.kind === "box-create" && + editorState.viewportTransientState.toolPreview.sourcePanelId !== activePanelId + ) { + store.clearViewportToolPreview(editorState.viewportTransientState.toolPreview.sourcePanelId); + } + blurActiveTextEntry(); store.setViewportLayoutMode(nextLayoutMode); setStatusMessage(`Switched the viewport to ${getViewportLayoutModeLabel(nextLayoutMode)}.`); @@ -1326,6 +1328,14 @@ export function App({ store, initialStatusMessage }: AppProps) { blurActiveTextEntry(); store.setViewportPanelViewMode(panelId, nextViewMode); + + if ( + editorState.viewportTransientState.toolPreview.kind === "box-create" && + editorState.viewportTransientState.toolPreview.sourcePanelId === panelId + ) { + store.clearViewportToolPreview(panelId); + } + setStatusMessage(`Set the ${getViewportPanelLabel(panelId)} panel to ${getViewportViewModeLabel(nextViewMode)} view.`); }; @@ -4082,9 +4092,7 @@ export function App({ store, initialStatusMessage }: AppProps) {