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): make activity-bar buttons coherent panel toggles

esengineb3fa755482fe
diff --git a/desktop/src/layout/ActivityBar.tsx b/desktop/src/layout/ActivityBar.tsx
index 9cfc341e6..27bb65a8d 100644
--- a/desktop/src/layout/ActivityBar.tsx
+++ b/desktop/src/layout/ActivityBar.tsx
@@ -14,12 +14,17 @@ export function ActivityBar() {
<button
type="button"
className="act"
- title="Toggle right dock"
- onClick={() => dockApi.toggleCollapse('outliner', 'width')}
+ title="Toggle Outliner"
+ onClick={() => dockApi.togglePanelCollapse('outliner')}
>
<ListTree size={19} strokeWidth={1.7} />
</button>
- <button type="button" className="act" title="Details" onClick={() => dockApi.reveal('details')}>
+ <button
+ type="button"
+ className="act"
+ title="Toggle Details"
+ onClick={() => dockApi.togglePanelCollapse('details')}
+ >
<SlidersHorizontal size={19} strokeWidth={1.7} />
</button>
<button
@@ -30,7 +35,12 @@ export function ActivityBar() {
>
<FolderOpen size={19} strokeWidth={1.7} />
</button>
- <button type="button" className="act" title="Output Log" onClick={() => dockApi.reveal('log')}>
+ <button
+ type="button"
+ className="act"
+ title="Output Log"
+ onClick={() => dockApi.revealAndExpand('log')}
+ >
<Terminal size={19} strokeWidth={1.7} />
</button>
diff --git a/desktop/src/layout/dockApi.ts b/desktop/src/layout/dockApi.ts
index 9f8271b48..856e6ea75 100644
--- a/desktop/src/layout/dockApi.ts
+++ b/desktop/src/layout/dockApi.ts
@@ -75,6 +75,25 @@ export const dockApi = {
return groupApi.height <= COLLAPSED_H + 8;
},
+ /** Toggle a panel's whole group collapsed/expanded (the activity-bar toggles). */
+ togglePanelCollapse(panelId: string) {
+ const panel = api?.getPanel(panelId);
+ const groupApi = panel?.group?.api;
+ if (!panel || !groupApi) return;
+ this.setGroupCollapsed(groupApi, panel.group.id, !this.groupCollapsed(groupApi));
+ },
+
+ /** Bring a panel's tab to front and expand its group if it was collapsed. */
+ revealAndExpand(panelId: string) {
+ const panel = api?.getPanel(panelId);
+ if (!panel) return;
+ panel.api.setActive();
+ const groupApi = panel.group?.api;
+ if (groupApi && this.groupCollapsed(groupApi)) {
+ this.setGroupCollapsed(groupApi, panel.group.id, false);
+ }
+ },
+
/**
* Collapse a dock group to its header bar (or expand it back), by height —
* the per-panel accordion the header chevron drives, animated (UE5 ease-out;