Skip to content

UIText

Defined in: ui/src/UIText.ts:24

Lightweight wrapper around a PixiJS Text for use in UI panels.

new UIText(props): UIText

Defined in: ui/src/UIText.ts:58

UITextProps

UIText

UIElementBase.constructor

readonly _transform: ElementTransform

Defined in: ui/src/UIElementBase.ts:20

Internal

UIElementBase._transform


readonly displayObject: DisplayContainer

Defined in: ui/src/UIText.ts:25

UIElementBase.displayObject


readonly yogaNode: Node

Defined in: ui/src/UIText.ts:26

UIElementBase.yogaNode

get rotation(): number

Defined in: ui/src/UIElementBase.ts:50

See LayoutProps.rotation.

number

set rotation(value): void

Defined in: ui/src/UIElementBase.ts:54

number

void

UIElementBase.rotation


get scale(): Readonly<{ x: number; y: number; }>

Defined in: ui/src/UIElementBase.ts:41

See LayoutProps.scale.

Readonly<{ x: number; y: number; }>

set scale(value): void

Defined in: ui/src/UIElementBase.ts:45

number | { x: number; y: number; }

void

UIElementBase.scale


get transformOrigin(): Readonly<{ x: number; y: number; }>

Defined in: ui/src/UIElementBase.ts:32

See LayoutProps.transformOrigin.

Readonly<{ x: number; y: number; }>

set transformOrigin(value): void

Defined in: ui/src/UIElementBase.ts:36

number | { x: number; y: number; }

void

UIElementBase.transformOrigin


get visible(): boolean

Defined in: ui/src/UIText.ts:229

boolean

set visible(v): void

Defined in: ui/src/UIText.ts:233

boolean

void

UIElementBase.visible


get zIndex(): number

Defined in: ui/src/UIElementBase.ts:59

See LayoutProps.zIndex.

number

set zIndex(value): void

Defined in: ui/src/UIElementBase.ts:63

number

void

UIElementBase.zIndex

_inspectState(): object

Defined in: ui/src/UIText.ts:311

Internal

What the Inspector reports for this label: whether it takes part in focus navigation, which is off unless the game asked for it, and whether it holds focus right now. A test reads this instead of a screenshot.

object

focusable: boolean

focused: boolean


applyLayout(): void

Defined in: ui/src/UIText.ts:174

Wrap — or truncate — a text Yoga laid out without measuring. Yoga calls a measure function only when an axis is left to measure, and that callback is the only other place word wrap is switched on and the truncated string is built. Both axes pinned leaves nothing to measure, and so does one pinned axis with the other filled by the default stretch alignment, which is what a plain panel does. Without this such a text renders one long unbroken line, and a truncating one renders its whole source past the slot edge.

Runs only when the computed width moved, because truncation binary-searches the text width and Pixi re-measures the block on every style write.

void


protected applyTransformProps(props): void

Defined in: ui/src/UIElementBase.ts:27

Apply the four transform props present in props. A present key holding undefined resets that prop to its default. Throws before writing anything if a value is not finite.

LayoutProps

void

UIElementBase.applyTransformProps


destroy(): void

Defined in: ui/src/UIText.ts:316

Idempotent — a second call is a no-op.

void

UIElementBase.destroy


mergeStyle(s): void

Defined in: ui/src/UIText.ts:225

Patch the current style: merge s over the properties already set (construction or a prior setStyle/mergeStyle) and re-apply. Unlike setStyle, properties you don’t pass are preserved — handy for an imperative recolour (mergeStyle({ fill })) that keeps the font, size, weight, etc.

Partial<TextStyle>

void


setStyle(s): void

Defined in: ui/src/UIText.ts:206

Replace the text style. Unset properties fall back to the engine + UI defaults (then Pixi’s), so this is a full replace, not a patch — to change a few properties while keeping the rest, use mergeStyle.

Partial<TextStyle>

void


setText(s?): void

Defined in: ui/src/UIText.ts:153

string

void


update(p): void

Defined in: ui/src/UIText.ts:238

Partial<UITextProps>

void

UIElementBase.update

Coding agents: fetch https://yage.dev/llms.txt first and prefer the Markdown references it links over these HTML pages. This page's Markdown counterpart is /llms/packages/ui.md.