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>
49 lines
1.4 KiB
TypeScript
49 lines
1.4 KiB
TypeScript
import { type Position, type PropertyBag, toPosition, type Vec2 } from './Properties';
|
||
|
||
/**
|
||
* An asset placed inside a scene. Overrides are sparse: only keys the user changed are stored,
|
||
* everything else follows the asset.
|
||
*/
|
||
export interface SceneObject {
|
||
id: string;
|
||
assetId: string;
|
||
/** Falls back to the asset name when empty. */
|
||
name: string;
|
||
/** Relative to the parent, `z` included; see `hierarchy.ts` for world coordinates. */
|
||
position: Position;
|
||
/**
|
||
* Editor-only shift of where this object and everything below it is drawn – never part of the
|
||
* game. It pulls apart objects that sit on top of each other without moving them for real.
|
||
*/
|
||
editorOffset: Vec2;
|
||
overrides: PropertyBag;
|
||
/**
|
||
* Parent object of the same scene, empty string = top level. Children move with their parent and
|
||
* are removed with it; behaviors treat their parent as the "owner" the graph acts on.
|
||
*/
|
||
parentId: string;
|
||
/**
|
||
* The template object inside the container asset this one was instantiated from, empty for
|
||
* everything else – the link that lets template changes reach the instances later on.
|
||
*/
|
||
templateId: string;
|
||
}
|
||
|
||
export function createSceneObject(
|
||
id: string,
|
||
assetId: string,
|
||
position: Vec2 | Position,
|
||
parentId = '',
|
||
): SceneObject {
|
||
return {
|
||
id,
|
||
assetId,
|
||
name: '',
|
||
position: toPosition(position),
|
||
editorOffset: { x: 0, y: 0 },
|
||
overrides: {},
|
||
parentId,
|
||
templateId: '',
|
||
};
|
||
}
|