TextBlock
import { TextBlock } from 'pixi-silk/ui/blocks';
A line or paragraph of text, drawn with drawText into the painter. Without a width or
height it takes the size of its text when it is made.
Extends#
Constructors#
Constructor#
new TextBlock(options: TextBlockOptions): TextBlock;
Parameters#
| Parameter | Type |
|---|---|
options | TextBlockOptions |
Returns#
TextBlock
Overrides#
Properties#
| Property | Modifier | Type | Description | Inherited from | Defined in |
|---|---|---|---|---|---|
h | public | number | Height of the slot, design units. The layout sets it. | Block.h | packages/pixi-silk/src/ui/blocks.ts:86 |
layer | readonly | BlockLayer | The layer it asked for. See BlockOptions.layer. | Block.layer | packages/pixi-silk/src/ui/blocks.ts:88 |
w | public | number | Width of the slot, design units. The layout sets it. | Block.w | packages/pixi-silk/src/ui/blocks.ts:84 |
Accessors#
surface#
Get Signature#
get surface(): BlockSurface | null;
The surface the block is in, or null.
Returns
BlockSurface | null
Inherited from#
Methods#
destroy()#
destroy(options?: DestroyOptions): void;
Stops following watched signals.
Parameters#
| Parameter | Type |
|---|---|
options? | DestroyOptions |
Returns#
void
Inherited from#
layout()#
layout(style?: SmartLayout): SmartLayout;
The flex style of this block’s slot: its size, no shrinking, and an onSize that keeps
w and h in step with the layout. An absolute slot stretched between two edges (inset,
or left and right) takes its size from them instead. Pass it to add of a
FlexContainer or SmartContainer.
Parameters#
| Parameter | Type |
|---|---|
style | SmartLayout |
Returns#
Inherited from#
paint()#
paint(
g: SilkGraphics,
x: number,
y: number
): void;
Draws the block into g with its slot’s top-left corner at (x, y), in the surface’s space.
Parameters#
| Parameter | Type |
|---|---|
g | SilkGraphics |
x | number |
y | number |
Returns#
void
Overrides#
step()#
step(dt: number): boolean;
Advances the block’s springs by dt seconds. Returns true while any moves. Override it to
animate something else, and return true while that runs.
Parameters#
| Parameter | Type |
|---|---|
dt | number |
Returns#
boolean
Inherited from#
wake()#
wake(): void;
Asks the surface to repaint this block. The surface repaints until every block settles, then
sleeps. The first call moves an 'auto' block to the live layer.
Returns#
void