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
@@ -4,8 +4,8 @@ import type { SceneObject } from '../model/SceneObject';
|
||||
import { propDef, schemaForAsset } from './PropertySchema';
|
||||
|
||||
/**
|
||||
* Effective property values of an asset: schema defaults filled with the asset's own values.
|
||||
* Keys unknown to the schema are ignored, so stale data never leaks into the editor.
|
||||
* Schema defaults filled with the asset's own values. Keys unknown to the schema are ignored, so
|
||||
* stale data never leaks into the editor.
|
||||
*/
|
||||
export function resolveAssetProps(asset: Asset): PropertyBag {
|
||||
const bag: PropertyBag = {};
|
||||
@@ -16,10 +16,7 @@ export function resolveAssetProps(asset: Asset): PropertyBag {
|
||||
return bag;
|
||||
}
|
||||
|
||||
/**
|
||||
* Effective property values of a scene object: asset values with the object's sparse
|
||||
* overrides applied on top. This is the ONLY place where overrides are merged.
|
||||
*/
|
||||
/** The only place where overrides are merged onto asset values. */
|
||||
export function resolveSceneObjectProps(asset: Asset, object: SceneObject): PropertyBag {
|
||||
const bag = resolveAssetProps(asset);
|
||||
for (const def of schemaForAsset(asset)) {
|
||||
@@ -33,10 +30,7 @@ export function isOverridden(object: SceneObject, key: string): boolean {
|
||||
return object.overrides[key] !== undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the asset's own value for `key` differs from the schema default – the asset-level
|
||||
* counterpart of an override. The inspector highlights such values and offers a reset.
|
||||
*/
|
||||
/** Whether the asset's own value differs from the schema default – the asset-level override. */
|
||||
export function isModified(asset: Asset, key: string): boolean {
|
||||
const def = propDef(asset, key);
|
||||
if (!def) return false;
|
||||
@@ -44,25 +38,20 @@ export function isModified(asset: Asset, key: string): boolean {
|
||||
return own !== undefined && own !== def.default;
|
||||
}
|
||||
|
||||
/** Value the object would have without its override for `key` (the asset's value). */
|
||||
/** The value the object would have without its override for `key`. */
|
||||
export function inheritedValue(asset: Asset, key: string): PropertyValue | undefined {
|
||||
return resolveAssetProps(asset)[key];
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the object's value for `key` really differs from the asset's – an override that
|
||||
* happens to carry the asset's own value is none. The inspector offers "reset"/"apply" only
|
||||
* where they would change something, so this is what decides whether the buttons appear.
|
||||
*/
|
||||
/** An override that happens to carry the asset's own value does not count as a deviation. */
|
||||
export function deviatesFromAsset(object: SceneObject, asset: Asset, key: string): boolean {
|
||||
const own = object.overrides[key];
|
||||
return own !== undefined && own !== inheritedValue(asset, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether the object's override for `key` differs from the template it was instantiated from.
|
||||
* Compared as overrides, not as effective values: both sides resolve against the same asset,
|
||||
* so "neither overrides" means equal even when the asset value changed since.
|
||||
* Compared as overrides, not as effective values: both sides resolve against the same asset, so
|
||||
* "neither overrides" means equal even when the asset value changed since.
|
||||
*/
|
||||
export function deviatesFromTemplate(object: SceneObject, template: SceneObject, key: string): boolean {
|
||||
return object.overrides[key] !== template.overrides[key];
|
||||
|
||||
Reference in new issue
Block a user