Editor model · class
Inspector
class Inspectorimport { Inspector } from '@driftengine/editor';Accessors
| Name | Type | Description |
|---|---|---|
fieldsget | readonly InspectorField[] | The fields of whatever is being shown. Reused between calls; copy what you keep. |
showingget | 'node' | 'entity' | 'nothing' | What is being shown: a SceneNode, an Entity, or nothing. |
Methods
showNothing
showNothing(): voidshowNode
showNode(node: SceneNode): void| Parameter | Type | Description |
|---|---|---|
node | SceneNode |
showEntity
showEntity(world: World, entity: Entity, types: readonly ComponentType[]): voidShow an entity's components — every one of types it actually has.
| Parameter | Type | Description |
|---|---|---|
world | World | |
entity | Entity | |
types | readonly ComponentType[] |
More
The types are passed rather than discovered for the reason serializeWorld gives: a world holds
a store for every type anything ever asked it about, empty ones included, so what to show is a
decision rather than everything that happens to exist.
refresh
refresh(): voidRe-read the values without rebuilding the list.
More
The list is stable while the selection is and the values are not, so a panel holding a row by index keeps holding the same field across a frame. Rebuilding every frame would also allocate.
set
set(index: number, value: unknown): booleanWrite a field back. false where the index is not a field, or the value is the wrong shape.
| Parameter | Type | Description |
|---|---|---|
index | number | |
value | unknown |
More
A refusal rather than a throw, because the caller is a panel inside a frame and a typed box that rejects what was typed into it is an ordinary thing for a panel to have to show.