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

+9 -20
View File
@@ -11,7 +11,6 @@ import { createFieldRow, type FieldHandlers, labelledRow } from './fieldFactory'
import { addGap, addNote, addTitle, type InspectorHost } from './host';
import { previewingHandlers } from './previewHandlers';
/** The components of the rectangle, in the order they are shown. */
const RECT_COMPONENTS = [
{ key: 'x', label: 'X' },
{ key: 'y', label: 'Y' },
@@ -19,11 +18,7 @@ const RECT_COMPONENTS = [
{ key: 'h', label: 'Height' },
] as const;
/**
* Structure-defining facts of a frame selection: none. A frame is a name and four numbers
* whatever texture it was cut from, so the rows never differ – only the frame disappearing
* can force a rebuild, and that is what `refreshFrameSection` reports.
*/
/** Structure-defining facts of a frame selection: none – only the frame disappearing rebuilds. */
export function frameSignature(project: Project, assetId: string, frameId: string): string {
return currentFrame(project, assetId, frameId) ? 'frame' : 'missing';
}
@@ -37,8 +32,8 @@ export function buildFrameSection(host: InspectorHost, assetId: string, frameId:
addTitle(host, 'TEXTURE FRAME');
host.nameField = new TextField(frame.name, {
onChange: (name) => {
// Like an asset name. The command rejects a blank name by itself; what it cannot do is
// put the old text back into the field, which is why an empty one is not sent at all.
// The command rejects a blank name but cannot put the old text back into the field,
// so an empty one is not sent at all.
if (name.trim()) host.state.execute(new RenameFrameCommand(assetId, frameId, name.trim()));
else host.nameField?.setValue(frame.name);
},
@@ -81,8 +76,7 @@ function rectRow(
): void {
const row = createFieldRow(
host,
// `decimals: 0` is honest here and only here in the inspector: `normalizeFrameRect` rounds
// every value that reaches the model, so the field never shortens a number it is holding.
// `decimals: 0` is safe here: `normalizeFrameRect` rounds every value that reaches the model.
{ key, label, kind: 'number', default: 0, step: 1, decimals: 0 },
value,
rectHandlers(host, assetId, frameId, key),
@@ -93,13 +87,9 @@ function rectRow(
/**
* The whole rectangle with one component replaced; the other three are read from the model at
* that moment, so a frame dragged in the Texture tab in between is not undone by typing into a
* field beside it.
*
* Normalising here as well as in the command is not a duplicate rule but the same one applied
* to the *preview*: an un-normalised preview would draw the frame off the sheet on the way
* through a scrub, and a half-typed "1" of "16" would jump it to the corner. Because it is the
* same function the command uses, what is previewed is exactly what is committed.
* that moment, so a frame dragged in the Texture tab in between is not undone. Normalising the
* preview with the same function the command uses keeps it on the sheet and identical to what
* is committed.
*/
function rectHandlers(
host: InspectorHost,
@@ -124,9 +114,8 @@ function rectHandlers(
}
/**
* The frame is looked up inside the selected texture rather than by its id alone: the
* selection names both, and honouring both keeps a selection left over from a deleted texture
* from editing whichever frame later inherits the id.
* Looked up inside the selected texture rather than by frame id alone, so a selection left over
* from a deleted texture cannot edit whichever frame later inherits the id.
*/
function currentFrame(project: Project, assetId: string, frameId: string): TextureFrame | undefined {
return currentTexture(project, assetId)?.frames.find((f) => f.id === frameId);