Skip to content
pixi-silk
GitHub repository
Class

ChoiceField

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

Segmented choices: a thumb slides to the chosen one and stretches on the way, like SegmentedSwitch, but it fills its row and shows no thumb for mixed values.

Extends#

Constructors#

Constructor#

new ChoiceField(ctx: FieldContext, options: ChoiceFieldOptions): ChoiceField;

Parameters#

ParameterType
ctxFieldContext
optionsChoiceFieldOptions

Returns#

ChoiceField

Overrides#

Field.constructor

Accessors#

fieldWidth#

Get Signature#

get fieldWidth(): number;

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

Returns

number

Inherited from#

Field.fieldWidth


index#

Get Signature#

get index(): number;

The chosen index, or -1 when mixed or empty.

Returns

number

Methods#

choose()#

choose(i: number): void;

Chooses option i for every edited object.

Parameters#

ParameterType
inumber

Returns#

void


destroy()#

destroy(options?: DestroyOptions): void;

Stops the animation. Destroys children unless options says otherwise.

Parameters#

ParameterType
options?DestroyOptions

Returns#

void

Inherited from#

Field.destroy


resize()#

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

Sets the size of the field box and redraws.

Parameters#

ParameterType
widthnumber
heightnumber

Returns#

void

Inherited from#

Field.resize


setEnabled()#

setEnabled(on: boolean): void;

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

Parameters#

ParameterType
onboolean

Returns#

void

Inherited from#

Field.setEnabled


show()#

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

Overrides#

Field.show


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

Inherited from#

Field.tick