Trim needless comments and fix the picker width

Remove comments that only restate the code, keeping the section banners
and the notes that carry a reason, a measured fact or an external
contract.

ButtonOptions.width claimed to be a fixed width but only set minWidth,
so the Graph and Texture pickers grew with the name they showed. It is
now what it promises, with a separate minWidth for the buttons that have
two forms. Narrow buttons shrink their padding, otherwise a 24px icon
button had 8px left for its glyph and truncate dropped it entirely.

__gm.labelsDropped() guards that class: the overflow guard only saw text
that was too wide, never a label truncated to nothing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
rootandClaude Opus 5 committed 2026-09-08 15:52:05 +02:00
1 parent f16801aef3
commit 4d84231b9f
115 files changed
+707 -1564

No files matched your search

+3 -19
View File
@@ -1,10 +1,7 @@
/**
* Owns everything that only exists while the project is playing: the world, its systems, the
* keyboard and the per-frame step.
*
* The key rule lives here: play never touches the saved model. `state.enterPlay()` swaps in a
* runtime copy, the world is built from that copy, edits made while playing go into it, and
* `exitPlay()` throws it away again.
* keyboard and the per-frame step. Play never touches the saved model – the world is built
* from the runtime copy `state.enterPlay()` swaps in and `exitPlay()` throws away.
*/
import { worldPositionOf } from '../core/graph';
import { BehaviorSystem, type Trace } from '../runtime/systems/BehaviorSystem';
@@ -32,13 +29,11 @@ export interface WorldSnapshot {
log: string[];
}
/** What a play session needs from the surrounding editor, and nothing more. */
export interface PlayHost {
gameView: GameViewport;
graphEditor: GraphEditor;
/** Bring the game view to the front – play has started. */
showGame(): void;
/** Leave the game view if it is the one on screen – play has stopped. */
/** Leave the game view if it is the one on screen. */
leaveGame(): void;
}
@@ -56,7 +51,6 @@ export class PlaySession {
return this.world !== null;
}
/** Live execution data for the graph editor (null when not playing). */
traceFor(assetId: string): Trace | null {
return this.behaviors?.traceFor(assetId) ?? null;
}
@@ -65,15 +59,10 @@ export class PlaySession {
return this.world?.time ?? 0;
}
/** Mirrors an edit made while playing into the running world at once. */
syncFromModel(): void {
this.world?.syncFromModel();
}
/**
* Starts a run: the state switches to a runtime copy, the world is built from it and shown
* in the Game tab. All panels stay open and edit the copy.
*/
play(): void {
const scene = this.state.activeScene;
if (!scene) return;
@@ -97,7 +86,6 @@ export class PlaySession {
if (world.stopRequested) this.stop();
}
/** Ends the run: the world and the runtime copy are discarded, the saved model returns untouched. */
stop(): void {
const world = this.world;
this.world = null;
@@ -112,7 +100,6 @@ export class PlaySession {
this.state.setNotice(lastError ?? '');
}
/** One frame. Does nothing when not playing. */
tick(dt: number): void {
const world = this.world;
if (!world) return;
@@ -122,20 +109,17 @@ export class PlaySession {
this.stop();
return;
}
// Restart game: throw the run away and start the scene again from the saved model.
if (world.restartRequested) {
this.stop();
this.play();
return;
}
// Mirror what the systems did into the runtime copy so the panels show live values.
// A destroyed entity removes its object – that is a structural change the lists must see.
if (world.syncToModel()) this.state.preview();
this.state.runtimeTick();
if (this.host.graphEditor.visible) this.host.graphEditor.canvas.redraw();
}
/** Read-only view of the running world for the check scripts. */
snapshot(): WorldSnapshot | null {
const world = this.world;
if (!world) return null;