Editor model · class

Inspector

class Inspector
import { Inspector } from '@driftengine/editor';

Accessors

NameTypeDescription
fieldsgetreadonly 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(): void

showNode

showNode(node: SceneNode): void
ParameterTypeDescription
nodeSceneNode

showEntity

showEntity(world: World, entity: Entity, types: readonly ComponentType[]): void

Show an entity's components — every one of types it actually has.

ParameterTypeDescription
worldWorld
entityEntity
typesreadonly 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(): void

Re-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): boolean

Write a field back. false where the index is not a field, or the value is the wrong shape.

ParameterTypeDescription
indexnumber
valueunknown
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.