Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(editor): tool buttons exit tile-paint; core panels can't be closed away

esengine601a05bab22f
diff --git a/desktop/src/commands/editorCommands.ts b/desktop/src/commands/editorCommands.ts
index e365f4045..d7ac5e975 100644
--- a/desktop/src/commands/editorCommands.ts
+++ b/desktop/src/commands/editorCommands.ts
@@ -20,6 +20,7 @@ import { applyFxPreview } from '@/engine/fxPreview';
import { dockApi } from '@/layout/dockApi';
import { panelDirtySource } from '@/layout/panelDirty';
import { DirtyRegistry } from '@/document/DirtyRegistry';
+import { isTilePaintMode, exitTilePaint } from '@/tools/tileMode';
import { EDITOR_MODES } from '@/mode/editorModes';
import { activeMode } from '@/mode/activeMode';
import { useEditorMode } from '@/store/editorModeStore';
@@ -31,7 +32,10 @@ import type { ToolMode } from '@/types';
const editor = () => useEditorStore.getState();
const sel = () => useSelection.getState();
-const tool = (mode: ToolMode) => () => editor().setTool(mode);
+// Selecting a transform tool while tile-painting must LEAVE paint mode (else the
+// paint tool keeps owning the stroke and the palette button reads as a no-op).
+// exitTilePaint sets the transform tool as it exits, so both paths agree.
+const tool = (mode: ToolMode) => () => (isTilePaintMode() ? exitTilePaint(mode) : editor().setTool(mode));
// — File / project —
commands.register({
diff --git a/desktop/src/layout/DockLayout.tsx b/desktop/src/layout/DockLayout.tsx
index 9d811dc3e..ca762cfa2 100644
--- a/desktop/src/layout/DockLayout.tsx
+++ b/desktop/src/layout/DockLayout.tsx
@@ -182,6 +182,13 @@ function retitleRestoredPanels(api: DockviewReadyEvent['api']) {
}
}
+// The essential editing panels have no reopen path (only the nuke-everything Reset
+// Layout), and the Viewport is the structural anchor other panels dock against — so
+// closing any is a dead-end. They stay open; resize or collapse-to-header for space.
+// The dockable extras (sequencer/profiler/mixer) keep their X — the activity bar
+// re-adds them.
+const NON_CLOSABLE_PANELS = new Set(['viewport', 'outliner', 'details', 'content', 'log']);
+
// Custom tab content: title + the shared dirty dot (asset editors) + a close
// button that only shows on hover / on the active tab, so the strip stays calm.
function EstellaTab(props: IDockviewPanelHeaderProps) {
@@ -216,25 +223,27 @@ function EstellaTab(props: IDockviewPanelHeaderProps) {
<SquareArrowOutUpRight size={11} strokeWidth={2} />
</button>
)}
- <button
- type="button"
- className="tab-x"
- title={t('ui.close')}
- aria-label={t('layout.closeTab', { title })}
- onPointerDown={(e) => e.stopPropagation()}
- onClick={(e) => {
- e.stopPropagation();
- void (async () => {
- if (source.isDirty()) {
- if (!(await confirmDiscardDoc(true, t('discard.closeTab', { title })))) return;
- source.discard?.();
- }
- props.api.close();
- })();
- }}
- >
- <X size={12} strokeWidth={2} />
- </button>
+ {!NON_CLOSABLE_PANELS.has(props.api.id) && (
+ <button
+ type="button"
+ className="tab-x"
+ title={t('ui.close')}
+ aria-label={t('layout.closeTab', { title })}
+ onPointerDown={(e) => e.stopPropagation()}
+ onClick={(e) => {
+ e.stopPropagation();
+ void (async () => {
+ if (source.isDirty()) {
+ if (!(await confirmDiscardDoc(true, t('discard.closeTab', { title })))) return;
+ source.discard?.();
+ }
+ props.api.close();
+ })();
+ }}
+ >
+ <X size={12} strokeWidth={2} />
+ </button>
+ )}
</div>
);
}