Lay out a scroll container's content when the content changes
A short list opened after a long one drew all its rows stacked on one point. The fault was not in the list tab: rebuild() handed the row stack to setContent() while it was still empty, so the content was sized to max(rows, viewport) = the viewport. The rows arrived after that, and for a short list the same formula yields the same height, so resize() saw no change and skipped layout(). A long list changes the height and never showed it. relayoutContent() now runs whenever the content changed, rather than leaning on resize()'s change detection - that detection is the wrong instrument for "the children moved". The list tab was the only affected caller: the panels use ListView, which positions its rows itself, and the inspector fills its body before setContent. Also drops the comma line under the list. Every section that can carry a list supplies openList, so the comma fallback in fieldFactory was unreachable; listToText/listFromText go with it. The list-value test now covers coerceListItem through coerceValue instead, so the boolean spelling stays guarded. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e52e95c0e9
commit
4d07946c74
9 files changed
+102
-87
No files matched your search
@@ -6,7 +6,7 @@ export const ListLiteral: NodeDef = {
|
||||
type: 'List',
|
||||
label: 'List',
|
||||
category: 'data',
|
||||
description: 'A constant list, typed as one comma-separated line.',
|
||||
description: 'A constant list, edited item by item in the List tab.',
|
||||
inputs: [],
|
||||
outputs: [list('value')],
|
||||
params: [{ key: 'value', label: 'Value', kind: 'list', default: [], items: 'number' }],
|
||||
|
||||
@@ -225,19 +225,6 @@ export function coerceValue(def: PropertyDef, value: PropertyValue): FieldValue
|
||||
}
|
||||
}
|
||||
|
||||
/** Colors read back as `#rrggbb` so what the inspector shows can be typed in again unchanged. */
|
||||
export function listToText(list: ListValue, items: ListItemKind): string {
|
||||
return list
|
||||
.map((v) => (items === 'color' ? `#${Number(v).toString(16).padStart(6, '0')}` : String(v)))
|
||||
.join(', ');
|
||||
}
|
||||
|
||||
export function listFromText(text: string, items: ListItemKind): ListValue {
|
||||
const trimmed = text.trim();
|
||||
if (trimmed === '') return [];
|
||||
return trimmed.split(',').map((part) => coerceListItem(part.trim(), items));
|
||||
}
|
||||
|
||||
export function coerceListItem(value: PropertyValue, items: ListItemKind): number | string | boolean {
|
||||
if (items === 'text') return isList(value) ? value.join(', ') : textOf(value);
|
||||
if (items === 'boolean') {
|
||||
|
||||
Reference in new issue
Block a user