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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
chore(editor): clear architecture-rearch leftovers
esengine7f4e058c57e9
diff --git a/desktop/src/layout/DockLayout.tsx b/desktop/src/layout/DockLayout.tsxindex 89504ecc1..68098574b 100644--- a/desktop/src/layout/DockLayout.tsx+++ b/desktop/src/layout/DockLayout.tsx@@ -75,42 +75,27 @@ function buildDefaultLayout(api: DockviewReadyEvent['api']) {});}-// Add the Sequencer as a bottom-dock tab if it isn't present yet. Run on both the-// fresh-build and the restored-layout paths so existing saved layouts (pre-v5-// Sequencer) gain the tab without resetting the user's whole arrangement.-function ensureSequencer(api: DockviewReadyEvent['api']) {- if (api.getPanel('sequencer')) return;- const ref = api.getPanel('content') ? 'content' : api.getPanel('log') ? 'log' : undefined;- api.addPanel({- id: 'sequencer',- component: 'sequencer',- title: 'Sequencer',- position: ref ? { referencePanel: ref, direction: 'within' } : undefined,- });-}--// Same idea for the Tileset editor — a bottom-dock tab added to fresh + restored layouts.-function ensureTileset(api: DockviewReadyEvent['api']) {- if (api.getPanel('tileset')) return;- const ref = api.getPanel('content') ? 'content' : api.getPanel('sequencer') ? 'sequencer' : undefined;- api.addPanel({- id: 'tileset',- component: 'tileset',- title: 'Tileset',- position: ref ? { referencePanel: ref, direction: 'within' } : undefined,- });-}--// The Tilemap painter — same bottom-dock tab treatment.-function ensureTilemap(api: DockviewReadyEvent['api']) {- if (api.getPanel('tilemap')) return;- const ref = api.getPanel('content') ? 'content' : api.getPanel('tileset') ? 'tileset' : undefined;- api.addPanel({- id: 'tilemap',- component: 'tilemap',- title: 'Tilemap',- position: ref ? { referencePanel: ref, direction: 'within' } : undefined,- });+// Bottom-dock editor 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.+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'] },+];++function ensureBottomTabs(api: DockviewReadyEvent['api']) {+ for (const tab of BOTTOM_TABS) {+ if (api.getPanel(tab.id)) continue;+ const ref = tab.refs.find((r) => api.getPanel(r));+ api.addPanel({+ id: tab.id,+ component: tab.component,+ title: tab.title,+ position: ref ? { referencePanel: ref, direction: 'within' } : undefined,+ });+ }}// A collapse/expand chevron in every dock group's header (the design's `.pcol`).@@ -156,11 +141,9 @@ export function DockLayout() {buildDefaultLayout(api);}- // Ensure the Sequencer tab exists, then keep the Content Browser fronted so- // adding it doesn't steal the bottom dock's active tab on load.- ensureSequencer(api);- ensureTileset(api);- ensureTilemap(api);+ // Ensure the bottom-dock editor tabs exist, then keep the Content Browser+ // fronted so adding them doesn't steal the bottom dock's active tab on load.+ ensureBottomTabs(api);api.getPanel('content')?.api.setActive();// Persist the dock arrangement so it survives reloads — a real editor habit.diff --git a/desktop/src/panels/Viewport.tsx b/desktop/src/panels/Viewport.tsxindex f1c0b893d..be61cc45a 100644--- a/desktop/src/panels/Viewport.tsx+++ b/desktop/src/panels/Viewport.tsx@@ -321,6 +321,25 @@ export function Viewport() {return () => cancelAnimationFrame(raf);}, []);+ // Esc cancels an in-progress stroke (revert the live drag via the tool's+ // transaction) instead of deselecting. Capture phase so it pre-empts the global+ // Esc→deselect command; a no-op when no stroke is active (deselect then runs).+ useEffect(() => {+ const onKey = (e: KeyboardEvent) => {+ if (e.key !== 'Escape') return;+ if (activeToolRef.current) {+ activeToolRef.current.cancel?.(toolCtx);+ activeToolRef.current = null;+ e.stopImmediatePropagation();+ } else if (panRef.current) {+ panRef.current = null;+ e.stopImmediatePropagation();+ }+ };+ window.addEventListener('keydown', onKey, true);+ return () => window.removeEventListener('keydown', onKey, true);+ }, [toolCtx]);+const onPointerDown = (e: ReactPointerEvent) => {if (engine.status !== 'ready') return;diff --git a/desktop/src/project/assetTypes.ts b/desktop/src/project/assetTypes.tsindex 319f8a5f7..c6be13642 100644--- a/desktop/src/project/assetTypes.ts+++ b/desktop/src/project/assetTypes.ts@@ -38,7 +38,9 @@ export const ASSET_TYPES: Record<AssetType, AssetTypeDef> = {spine: { extensions: ['atlas', 'skel'], badge: 'SPN', icon: PersonStanding, tint: '#9b8fc0' },audio: { extensions: ['ogg', 'mp3', 'wav'], badge: 'AUD', icon: Music, tint: '#7faf9c' },prefab: { extensions: ['esprefab'], badge: 'PFB', icon: Component, tint: '#c2a274' },- material: { extensions: ['esmat'], badge: 'MAT', icon: Blend, tint: '#c0917a' },+ // .esmaterial is the real extension (the SDK MaterialAssetLoader only loads it);+ // .esmat is tolerated as a legacy alias (cf. electron/importAssets.ts).+ material: { extensions: ['esmaterial', 'esmat'], badge: 'MAT', icon: Blend, tint: '#c0917a' },script: { extensions: ['ts', 'js'], badge: 'TS', icon: FileCode2, tint: '#93a3bf' },// Unified animation clip (.esanim) + legacy multi-track timeline (.estimeline).animation: { extensions: ['esanim', 'estimeline'], badge: 'ANM', icon: Clapperboard, tint: '#9bb39a' },diff --git a/desktop/tests/asset-types.test.ts b/desktop/tests/asset-types.test.tsindex 641550cb3..a7414b37f 100644--- a/desktop/tests/asset-types.test.ts+++ b/desktop/tests/asset-types.test.ts@@ -16,6 +16,8 @@ describe('asset type registry', () => {expect(assetTypeOf('a.atlas')).toBe('spine');expect(assetTypeOf('a.skel')).toBe('spine');expect(assetTypeOf('a.esprefab')).toBe('prefab');+ expect(assetTypeOf('a.esmaterial')).toBe('material'); // real ext (SDK loader)+ expect(assetTypeOf('a.esmat')).toBe('material'); // legacy aliasexpect(assetTypeOf('a.esmat')).toBe('material');expect(assetTypeOf('a.esanim')).toBe('animation');expect(assetTypeOf('a.estimeline')).toBe('animation');