Skip to content
pixi-silk
GitHub repository
Class

Field

import { Field } from 'pixi-silk/ui/inspector';

A field: a box of a given size that shows values and edits them. It holds no data. It shows what Field.show gives it and reports edits through its options. The Inspector builds these.

Extends#

  • Container

Extended by#

Constructors#

Constructor#

new Field(ctx: FieldContext, label: string): Field;

Parameters#

ParameterType
ctxFieldContext
labelstring

Returns#

Field

Overrides#

Container.constructor

Accessors#

fieldWidth#

Get Signature#

get fieldWidth(): number;

Width of the field box. Default 120 until Field.resize.

Returns

number

Methods#

destroy()#

destroy(options?: DestroyOptions): void;

Stops the animation. Destroys children unless options says otherwise.

Parameters#

ParameterType
options?DestroyOptions

Returns#

void

Overrides#

Container.destroy

resize()#

resize(width: number, height: number): void;

Sets the size of the field box and redraws.

Parameters#

ParameterType
widthnumber
heightnumber

Returns#

void


setEnabled()#

setEnabled(on: boolean): void;

False dims the field and ignores input, while nothing is edited.

Parameters#

ParameterType
onboolean

Returns#

void


show()#

abstract show(values: readonly unknown[]): void;

Shows the values of the edited objects, one per object. Differing values show as mixed. An empty list disables the field.

Parameters#

ParameterType
valuesreadonly unknown[]

Returns#

void


tick()#

tick(dt: number): boolean;

Advances the motion by dt seconds (only needed with ticker: null). Returns true while moving.

Parameters#

ParameterType
dtnumber

Returns#

boolean