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
@@ -8,9 +8,8 @@ export interface StackOptions {
|
||||
}
|
||||
|
||||
/**
|
||||
* Lays out child widgets in a row or column. Children with `flex > 0` share the space
|
||||
* left over after fixed children got their measured size (weighted by `flex`).
|
||||
* Non-widget children are ignored by the layout but still rendered.
|
||||
* Lays out child widgets in a row or column. Children with `flex > 0` share, weighted, the space
|
||||
* left after the fixed ones took their measured size. Non-widget children are still rendered.
|
||||
*/
|
||||
export abstract class Stack extends Widget {
|
||||
gap: number;
|
||||
@@ -27,12 +26,12 @@ export abstract class Stack extends Widget {
|
||||
this.align = options.align ?? 'stretch';
|
||||
}
|
||||
|
||||
/** The children the layout distributes space among: visible widgets, in child order. */
|
||||
/** The children space is distributed among: visible widgets, in child order. */
|
||||
get items(): Widget[] {
|
||||
return this.children.filter((c): c is Widget => c instanceof Widget && c.visible);
|
||||
}
|
||||
|
||||
/** Appends `widget` with the given flex share. Does not lay out; call `relayout()` once the stack is sized. */
|
||||
/** Does not lay out; call `relayout()` once the stack is sized. */
|
||||
add<T extends Widget>(widget: T, flex = 0): T {
|
||||
widget.flex = flex;
|
||||
this.addChild(widget);
|
||||
@@ -96,14 +95,12 @@ export abstract class Stack extends Widget {
|
||||
}
|
||||
}
|
||||
|
||||
/** Column layout. */
|
||||
export class VStack extends Stack {
|
||||
constructor(options: StackOptions = {}) {
|
||||
super('y', options);
|
||||
}
|
||||
}
|
||||
|
||||
/** Row layout. */
|
||||
export class HStack extends Stack {
|
||||
constructor(options: StackOptions = {}) {
|
||||
super('x', options);
|
||||
|
||||
Reference in new issue
Block a user