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:
1 parent
f16801aef3
commit
4d84231b9f
115 files changed
+707
-1564
No files matched your search
+3
-12
@@ -19,7 +19,6 @@ import { installTextureImport } from './textureImport';
|
||||
|
||||
export type CentreTab = 'scene' | 'graph' | 'game' | 'texture';
|
||||
|
||||
/** Tab strip order – also the one list `showTab` walks, so a new tab cannot be half-added. */
|
||||
const TAB_ORDER = ['scene', 'game', 'graph', 'texture'] as const;
|
||||
|
||||
const MIN_LEFT_WIDTH = 160;
|
||||
@@ -38,7 +37,6 @@ export class Editor implements PlayHost {
|
||||
/** Game tab: the running world through its camera. */
|
||||
readonly gameView: GameViewport;
|
||||
readonly graphEditor: GraphEditor;
|
||||
/** Texture tab: one sheet with its frames. */
|
||||
readonly textureEditor: TextureEditor;
|
||||
readonly hierarchy: HierarchyPanel;
|
||||
tab: CentreTab = 'scene';
|
||||
@@ -73,7 +71,6 @@ export class Editor implements PlayHost {
|
||||
this.hierarchy = new HierarchyPanel(state);
|
||||
this.inspector = new Inspector(state);
|
||||
this.play = new PlaySession(state, this);
|
||||
// A run holds a copy of the project, so it has to end before a different one is loaded.
|
||||
this.projects = new ProjectSession(state, store, () => {
|
||||
if (this.play.isPlaying) this.play.stop();
|
||||
});
|
||||
@@ -91,12 +88,9 @@ export class Editor implements PlayHost {
|
||||
this.workspace = new HStack();
|
||||
this.leftColumn = new VStack({ gap: 1 });
|
||||
this.leftColumn.add(new AssetPanel(state, () => this.viewport.worldCenter(), textures), 1);
|
||||
// Dropping an image on the canvas or pasting one imports it, wherever the pointer is –
|
||||
// the same import the asset panel's "Texture" entry runs.
|
||||
installTextureImport(app.canvas, { state, textures });
|
||||
this.leftColumn.add(this.hierarchy, 1);
|
||||
|
||||
// Centre: a tab strip above the scene view, the game view, the graph editor or the sheet editor.
|
||||
this.centre = new VStack();
|
||||
const tabs = new HStack({ gap: 2, padding: 4, align: 'center' });
|
||||
tabs.minHeight = Theme.controlHeight + 8;
|
||||
@@ -144,15 +138,13 @@ export class Editor implements PlayHost {
|
||||
attachAutosave(state, store);
|
||||
installShortcuts(state, { play: () => this.play.play(), stop: () => this.play.stop() });
|
||||
app.ticker.add((ticker) => this.tick(ticker.deltaMS / 1000));
|
||||
// Selecting a graph node switches to the graph, selecting a frame to the sheet: both are
|
||||
// things that exist *only* in their tab, so a selection you could not see would be a lie.
|
||||
// Selecting the behavior or the texture asset itself does not force anything.
|
||||
// A node and a frame exist only in their own tab, so selecting one switches to it;
|
||||
// selecting the behavior or texture asset itself does not.
|
||||
state.on('selection', () => {
|
||||
const kind = state.selection?.kind;
|
||||
if (kind === 'node' && this.tab !== 'graph') this.showTab('graph');
|
||||
if (kind === 'frame' && this.tab !== 'texture') this.showTab('texture');
|
||||
});
|
||||
// While playing, every edit (command, undo, scrub preview) is mirrored into the world at once.
|
||||
state.on('project', () => this.play.syncFromModel());
|
||||
}
|
||||
|
||||
@@ -167,7 +159,6 @@ export class Editor implements PlayHost {
|
||||
ui().focus.validate();
|
||||
}
|
||||
|
||||
/** Opens the project named in the URL, else the first one on the server, else a new one. */
|
||||
boot(): Promise<void> {
|
||||
return this.projects.boot();
|
||||
}
|
||||
@@ -189,7 +180,7 @@ export class Editor implements PlayHost {
|
||||
this.play.tick(dt);
|
||||
}
|
||||
|
||||
/** Counts rendered frames (edit and play alike) and refreshes the toolbar readout twice a second. */
|
||||
/** Refreshes the toolbar readout twice a second. */
|
||||
private measureFps(dt: number): void {
|
||||
this.fpsFrames += 1;
|
||||
this.fpsElapsed += dt;
|
||||
|
||||
Reference in new issue
Block a user