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): panels degrade gracefully when docked narrow

esenginef33219131248
diff --git a/desktop/src/layout/dockApi.ts b/desktop/src/layout/dockApi.ts
index 8c999a900..4b7113e81 100644
--- a/desktop/src/layout/dockApi.ts
+++ b/desktop/src/layout/dockApi.ts
@@ -66,6 +66,10 @@ export const dockApi = {
reveal(id: string) {
api?.getPanel(id)?.api.setActive();
},
+ /** Resize a docked panel's group (automation/shot tests: reproduce narrow docks). */
+ setPanelSize(id: string, size: { width?: number; height?: number }) {
+ api?.getPanel(id)?.api.setSize(size);
+ },
/** True when a panel may be popped out into its own OS window (see NON_POPPABLE). */
canPopout(id: string): boolean {
return !NON_POPPABLE.has(id) && !id.startsWith('game-client-');
diff --git a/desktop/src/main.tsx b/desktop/src/main.tsx
index 8b57a1fd4..d30afd5c0 100644
--- a/desktop/src/main.tsx
+++ b/desktop/src/main.tsx
@@ -164,6 +164,8 @@ if (new URLSearchParams(location.search).has('automation')) {
ASSET_OPEN[assetTypeOf(name)]?.(path, name);
},
reveal: (id: string) => dockApi.revealAndExpand(id),
+ /** Resize a docked panel (shot tests: reproduce narrow-dock layouts). */
+ setPanelSize: (id: string, size: { width?: number; height?: number }) => dockApi.setPanelSize(id, size),
/** The Output Log's captured entries (editor + SDK + wasm + play realm),
* newest last — an agent's only eyes on runtime errors. */
logs: (tail = 50) => LogStore.getSnapshot().slice(-tail),
diff --git a/desktop/src/outliner/OutlinerRow.tsx b/desktop/src/outliner/OutlinerRow.tsx
index f7b3088d8..61598c5d7 100644
--- a/desktop/src/outliner/OutlinerRow.tsx
+++ b/desktop/src/outliner/OutlinerRow.tsx
@@ -151,7 +151,7 @@ function OutlinerRowInner(props: OutlinerRowProps) {
col.applies(item) ? (
<Fragment key={col.id}>{col.render(item, columnCtx)}</Fragment>
) : (
- <span key={col.id} className="rcol-spacer" style={{ width: col.width }} />
+ <span key={col.id} className="rcol-spacer" data-col={col.id} style={{ width: col.width }} />
),
)}
</div>
diff --git a/desktop/src/panels/Outliner.tsx b/desktop/src/panels/Outliner.tsx
index 7770acae7..06a13c78d 100644
--- a/desktop/src/panels/Outliner.tsx
+++ b/desktop/src/panels/Outliner.tsx
@@ -664,7 +664,7 @@ export function Outliner() {
>
<span className="c-name">{t('out.colName')}</span>
{activeColumns.map((col) => (
- <span key={col.id} className="c-col" style={{ width: col.width }}>
+ <span key={col.id} className="c-col" data-col={col.id} style={{ width: col.width }}>
{col.header}
</span>
))}
diff --git a/desktop/src/theme/app.css b/desktop/src/theme/app.css
index afa23fa8e..629b010f8 100644
--- a/desktop/src/theme/app.css
+++ b/desktop/src/theme/app.css
@@ -93,6 +93,8 @@
flex-direction: column;
height: 100%;
background: var(--panel);
+ /* Size container: panel content degrades via @container as the dock narrows. */
+ container-type: inline-size;
}
.btn-soft {
@@ -166,6 +168,8 @@
height: 100%;
background: var(--void);
overflow: hidden;
+ /* Size container: overlay chrome repositions via @container when squeezed. */
+ container-type: inline-size;
}
.viewport__stage {
position: absolute;
@@ -708,6 +712,13 @@ body.thumb-capture .viewport > :not(.viewport__stage):not(.viewport__play) {
pointer-events: none;
}
+/* Squeezed viewport: the centered flags would slide under the top toolbars —
+ drop them to a second row instead of overlapping. */
+@container (max-width: 1099px) {
+ .viewport__tileflag,
+ .viewport__playflag { top: 54px; }
+}
+
/* Engine boot / error overlay, centered over the stage. */
.viewport__status {
position: absolute;
diff --git a/desktop/src/theme/inspector.css b/desktop/src/theme/inspector.css
index ff899e65a..240f8ebb6 100644
--- a/desktop/src/theme/inspector.css
+++ b/desktop/src/theme/inspector.css
@@ -9,7 +9,8 @@
========================================================================== */
/* ════════════════════════ INSPECTOR (Details) ════════════════════════ */
-.insp { display: flex; flex-direction: column; height: 100%; min-height: 0; }
+/* Size container: field rows restack via @container when the dock gets narrow. */
+.insp { display: flex; flex-direction: column; height: 100%; min-height: 0; container-type: inline-size; }
/* shared .phead, one row taller for the 26px search well */
.insp-head { height: 38px; }
.insp-head .search { height: 26px; }
@@ -132,9 +133,23 @@
.prop:hover .prop-reset.show, .prop.modified .prop-reset.show { opacity: .85; }
.prop-reset:hover { opacity: 1 !important; }
+/* Narrow dock: the 38% label column would crush the controls into unreadable
+ slivers, so rows restack — label on its own line, controls on the full row
+ width below (the standard modern-inspector degradation). */
+@container (max-width: 252px) {
+ .prop { grid-template-columns: 1fr 18px; row-gap: 1px; }
+ .prop-label { grid-column: 1 / -1; }
+ .prop-value { grid-column: 1; }
+ .prop-reset { grid-column: 2; grid-row: 2; }
+}
+
/* `.field` (the input well NumField and the dropdown trigger sit in) is the
shared primitive in controls.css. */
-.vec { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; flex: 1; min-width: 0; }
+/* Components share the row but wrap instead of crushing once each can't keep
+ a readable minimum (grid auto-fit is unreliable inside a flex item — the
+ track count resolves from min-content there — so plain flex wrap it is). */
+.vec { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; min-width: 0; }
+.vec .vfield { flex: 1 1 56px; }
.vfield { height: 22px; display: flex; align-items: center; background: var(--inset); border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; min-width: 0; transition: border-color var(--t-fast), box-shadow var(--t-fast); }
.vfield:focus-within { border-color: var(--acc); box-shadow: 0 0 0 2px var(--acc-soft); }
.ax { width: 16px; height: 100%; display: grid; place-items: center; font-size: var(--fs-3xs); font-weight: 700; font-family: var(--mono); color: var(--on-accent); cursor: ew-resize; flex-shrink: 0; font-style: normal; }
diff --git a/desktop/src/theme/outliner.css b/desktop/src/theme/outliner.css
index 031108a56..4a565f5b8 100644
--- a/desktop/src/theme/outliner.css
+++ b/desktop/src/theme/outliner.css
@@ -80,6 +80,13 @@
.row .rcol-spacer { flex-shrink: 0; } /* aligns columns where a row has no cell (e.g. folder lock/vis) */
.row .rtype { width: 78px; font-size: var(--fs-2xs); color: var(--text-mute); font-family: var(--mono); flex-shrink: 0; }
.row.sel .rtype { color: rgba(255, 255, 255, 0.72); }
+/* Narrow dock: the fixed Type column would eat the name into "C…" slivers —
+ drop it and give the name the full row (lock/visibility keep their cells). */
+@container (max-width: 209px) {
+ .row .rtype,
+ .row .rcol-spacer[data-col='type'],
+ .outliner-cols .c-col[data-col='type'] { display: none; }
+}
.row .rvis, .row .rlock { width: 24px; display: grid; place-items: center; color: var(--text-mute); opacity: 0; transition: opacity var(--t-fast), color var(--t-fast); flex-shrink: 0; }
.row:hover .rvis, .row.sel .rvis, .row.hidden .rvis { opacity: 1; }
.row:hover .rlock, .row.sel .rlock, .row.locked .rlock { opacity: 1; }