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
@@ -2,16 +2,11 @@ import type { Asset } from '../model/Asset';
|
||||
import { type AssetType, isPlaceableType } from '../model/AssetTypes';
|
||||
import { findAsset, type Project } from '../model/Project';
|
||||
|
||||
/** Shown for an `asset` property that references nothing. */
|
||||
export const NO_ASSET_LABEL = 'None';
|
||||
|
||||
/**
|
||||
* How an `asset` reference reads wherever it is displayed: the referenced asset's name, "None"
|
||||
* for the empty id, and `<id>?` when the id no longer resolves.
|
||||
*
|
||||
* A dangling reference keeps showing its id instead of falling back to "None": the id is the
|
||||
* only trace left of what was meant, and blanking it would make a deleted asset look like a
|
||||
* field that was never filled in. `project` may be null while a view has no project yet.
|
||||
* The asset's name, "None" for the empty id, `<id>?` when it no longer resolves – a dangling
|
||||
* reference shows its id rather than passing for an empty field.
|
||||
*/
|
||||
export function assetRefLabel(project: Project | null, id: string): string {
|
||||
if (id === '') return NO_ASSET_LABEL;
|
||||
@@ -19,10 +14,8 @@ export function assetRefLabel(project: Project | null, id: string): string {
|
||||
}
|
||||
|
||||
/**
|
||||
* The assets an `asset` property offers, in menu order. `assetTypes` restricts them to those
|
||||
* types; without it every *placeable* asset is offered, which is what a graph node acting on
|
||||
* an object means by "asset". Sorted by name (then type) so the order does not depend on when
|
||||
* the assets happened to be created.
|
||||
* The assets an `asset` property offers, in menu order; without `assetTypes` every placeable one.
|
||||
* Sorted by name so the order does not depend on creation time.
|
||||
*/
|
||||
export function assetRefChoices(project: Project, assetTypes?: readonly AssetType[]): Asset[] {
|
||||
const allowed = (asset: Asset): boolean =>
|
||||
@@ -32,7 +25,6 @@ export function assetRefChoices(project: Project, assetTypes?: readonly AssetTyp
|
||||
.sort((a, b) => a.name.localeCompare(b.name) || a.type.localeCompare(b.type));
|
||||
}
|
||||
|
||||
/** Menu entry for one candidate – the type disambiguates assets that share a name. */
|
||||
export function assetChoiceLabel(asset: Asset): string {
|
||||
return `${asset.name} (${asset.type})`;
|
||||
}
|
||||
Reference in new issue
Block a user