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.

refactor(editor): editors to a document area, not a crammed bottom dock

esengineb010bd5a30d2
diff --git a/desktop/src/layout/ActivityBar.tsx b/desktop/src/layout/ActivityBar.tsx
index 78757f71b..80c203685 100644
--- a/desktop/src/layout/ActivityBar.tsx
+++ b/desktop/src/layout/ActivityBar.tsx
@@ -2,7 +2,7 @@
// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
// Far-left icon rail (activity bar). Reveals docked panels and toggles the
// Content Drawer — the summoned quick-access surface.
-import { ListTree, SlidersHorizontal, FolderOpen, Terminal, Clapperboard, Settings } from 'lucide-react';
+import { ListTree, SlidersHorizontal, FolderOpen, Terminal, Clapperboard, Grid3x3, Settings } from 'lucide-react';
import { useEditorStore } from '@/store/editorStore';
import { dockApi } from '@/layout/dockApi';
import { commands } from '@/commands';
@@ -53,6 +53,14 @@ export function ActivityBar() {
>
<Clapperboard size={19} strokeWidth={1.7} />
</button>
+ <button
+ type="button"
+ className="act"
+ title="Tilemap Painter (binds to the selected Tilemap)"
+ onClick={() => dockApi.openSidePanel('tilemap', 'tilemap', 'Tilemap', 'left', 300)}
+ >
+ <Grid3x3 size={19} strokeWidth={1.7} />
+ </button>
<span className="act-spacer" />
diff --git a/desktop/src/layout/DockLayout.tsx b/desktop/src/layout/DockLayout.tsx
index c8555d3fe..6267d7690 100644
--- a/desktop/src/layout/DockLayout.tsx
+++ b/desktop/src/layout/DockLayout.tsx
@@ -35,11 +35,12 @@ const components: Record<string, FC<IDockviewPanelProps>> = {
game: () => <GamePanel />,
};
-// Bumped to v5 (tabbed docking): Viewport center, right column Outliner-over-
-// Details, and Content Browser + Output Log as sibling tabs along the bottom
-// (resize/close via dockview). The Content Drawer (Ctrl+Space) is a separate
-// quick-access overlay on top.
-const LAYOUT_KEY = 'estella.editor.layout.v5';
+// Bumped to v6 (document-area editors): Viewport center, right column Outliner-
+// over-Details, Content Browser + Output Log + Sequencer as bottom tabs. The big
+// editing canvases (Material Graph / Tilemap / Tileset) are NOT bottom tabs — they
+// open on-demand as document tabs beside the Viewport (dockApi.openDocument),
+// matching UE/Unity. The Content Drawer (Ctrl+Space) is a separate overlay.
+const LAYOUT_KEY = 'estella.editor.layout.v6';
function buildDefaultLayout(api: DockviewReadyEvent['api']) {
// Viewport is the anchor; the right column stacks Outliner over Details.
@@ -77,15 +78,14 @@ function buildDefaultLayout(api: DockviewReadyEvent['api']) {
});
}
-// Bottom-dock editor tabs added on both fresh builds and restored layouts, so a
+// Bottom-dock utility tabs added on both fresh builds and restored layouts, so a
// saved layout predating a tab gains it without resetting the user's arrangement.
-// Each docks next to the first of `refs` that exists; tabs are added in order, so
-// a later tab may reference an earlier one. Adding a bottom-dock tab is one entry.
+// Each docks next to the first of `refs` that exists. The big editing canvases
+// (Material Graph / Tilemap / Tileset) are intentionally NOT here — they open as
+// center document tabs on demand (dockApi.openDocument); only the timeline-shaped
+// Sequencer belongs in the bottom utility row (UE convention).
const BOTTOM_TABS: { id: string; component: string; title: string; refs: string[] }[] = [
{ id: 'sequencer', component: 'sequencer', title: 'Sequencer', refs: ['content', 'log'] },
- { id: 'tileset', component: 'tileset', title: 'Tileset', refs: ['content', 'sequencer'] },
- { id: 'tilemap', component: 'tilemap', title: 'Tilemap', refs: ['content', 'tileset'] },
- { id: 'materialgraph', component: 'materialgraph', title: 'Material Graph', refs: ['content', 'tilemap'] },
];
function ensureBottomTabs(api: DockviewReadyEvent['api']) {
diff --git a/desktop/src/layout/dockApi.ts b/desktop/src/layout/dockApi.ts
index 6de72e8d5..4212a31b0 100644
--- a/desktop/src/layout/dockApi.ts
+++ b/desktop/src/layout/dockApi.ts
@@ -41,6 +41,43 @@ export const dockApi = {
reveal(id: string) {
api?.getPanel(id)?.api.setActive();
},
+ /**
+ * Open (or front) a large editor as a document tab in the CENTER stage beside
+ * the Viewport — the modern unified-editor home for full editing canvases
+ * (Material Graph, Tilemap, Tileset), opened on-demand and closeable. Creates
+ * the panel on first open; subsequent calls just front it.
+ */
+ openDocument(id: string, component: string, title: string) {
+ if (!api) return;
+ if (!api.getPanel(id)) {
+ api.addPanel({
+ id,
+ component,
+ title,
+ position: api.getPanel('viewport') ? { referencePanel: 'viewport', direction: 'within' } : undefined,
+ });
+ }
+ api.getPanel(id)?.api.setActive();
+ },
+ /**
+ * Open (or front) a companion tool panel docked beside the Viewport (default
+ * left) so it stays visible WHILE you work in the Viewport — for palettes like
+ * the Tilemap painter, where painting happens in the Viewport and a center
+ * document tab would hide it. Opened on-demand and closeable.
+ */
+ openSidePanel(id: string, component: string, title: string, direction: 'left' | 'right' = 'left', width = 300) {
+ if (!api) return;
+ if (!api.getPanel(id)) {
+ api.addPanel({
+ id,
+ component,
+ title,
+ position: api.getPanel('viewport') ? { referencePanel: 'viewport', direction } : undefined,
+ initialWidth: width,
+ });
+ }
+ api.getPanel(id)?.api.setActive();
+ },
/** Open (or reveal) the Game view as a tab beside the Viewport — used on Play. */
openGame() {
if (!api) return;
diff --git a/desktop/src/material/openMaterialGraph.ts b/desktop/src/material/openMaterialGraph.ts
index c3af00e01..1f47c335d 100644
--- a/desktop/src/material/openMaterialGraph.ts
+++ b/desktop/src/material/openMaterialGraph.ts
@@ -22,7 +22,7 @@ export async function openMaterialGraph(path: string): Promise<void> {
try {
const text = await window.estella.fs.read(path);
MaterialGraphDocument.openJson(JSON.parse(text), path);
- dockApi.revealAndExpand('materialgraph');
+ dockApi.openDocument('materialgraph', 'materialgraph', 'Material Graph');
} catch (e) {
Toasts.push(`无法打开材质图:${String(e)}`, 'error');
}
diff --git a/desktop/src/tilemap/createTilemap.ts b/desktop/src/tilemap/createTilemap.ts
index 48ead29ae..d8e2a9e9b 100644
--- a/desktop/src/tilemap/createTilemap.ts
+++ b/desktop/src/tilemap/createTilemap.ts
@@ -64,6 +64,8 @@ export async function createTilemapFromTileset(tilesetPath: string): Promise<voi
useSelection.getState().select(sourceId);
useTilemapPaint.getState().setTileset(tilesetPath);
useTilemapPaint.getState().setTool('brush');
- dockApi.revealAndExpand('tilemap');
+ // The painter is a palette companion to viewport painting — dock it to the side
+ // so the Viewport stays visible (a center tab would hide what you paint on).
+ dockApi.openSidePanel('tilemap', 'tilemap', 'Tilemap', 'left', 300);
Toasts.push('已创建瓦片地图 — 选择刷子在视口绘制', 'info');
}
diff --git a/desktop/src/tileset/openTileset.ts b/desktop/src/tileset/openTileset.ts
index 33ce6072f..e2dcce870 100644
--- a/desktop/src/tileset/openTileset.ts
+++ b/desktop/src/tileset/openTileset.ts
@@ -19,7 +19,7 @@ export async function openTileset(path: string): Promise<void> {
try {
const text = await window.estella.fs.read(path);
TilesetDocument.openJson(JSON.parse(text), path);
- dockApi.revealAndExpand('tileset');
+ dockApi.openDocument('tileset', 'tileset', 'Tileset');
} catch (e) {
Toasts.push(`无法打开瓦片集:${String(e)}`, 'error');
}