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.

feat: display current scene name in menu bar

esengine3a256e107eb1
diff --git a/editor/src/Editor.ts b/editor/src/Editor.ts
index 9d3ba0f34..824d8d4d1 100644
--- a/editor/src/Editor.ts
+++ b/editor/src/Editor.ts
@@ -1008,7 +1008,9 @@ export class Editor {
<div class="es-editor-menubar">
<div class="es-menubar-logo">${icons.logo(24)}</div>
${this.buildMenuBarHTML()}
- <div class="es-menubar-spacer"></div>
+ <div class="es-menubar-spacer">
+ <span class="es-menubar-scene-name"></span>
+ </div>
<button class="es-btn es-btn-preview" data-action="preview">${icons.play(14)} Preview</button>
</div>
<div class="es-editor-tabs">
@@ -1257,6 +1259,20 @@ export class Editor {
for (const instance of this.statusbarInstances_) {
instance.update?.();
}
+ this.updateSceneNameDisplay();
+ }
+
+ private updateSceneNameDisplay(): void {
+ const el = this.container_.querySelector('.es-menubar-scene-name');
+ if (!el) return;
+ const filePath = this.store_.filePath;
+ const dirty = this.store_.isDirty ? ' *' : '';
+ if (filePath) {
+ const fileName = filePath.replace(/^.*[/\\]/, '');
+ el.textContent = fileName + dirty;
+ } else {
+ el.textContent = this.store_.scene.name + dirty;
+ }
}
dispose(): void {
diff --git a/editor/src/styles/editor.css b/editor/src/styles/editor.css
index e96ef47f3..cedab0c27 100644
--- a/editor/src/styles/editor.css
+++ b/editor/src/styles/editor.css
@@ -138,6 +138,15 @@ svg {
.es-menubar-spacer {
flex: 1;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+
+.es-menubar-scene-name {
+ font-size: 12px;
+ color: var(--es-text-secondary);
+ opacity: 0.8;
}
.es-menu {