Skip to content
pixi-silk
GitHub repository
Class

SpacingMarkers

import { SpacingMarkers } from 'pixi-silk/ui/spacing';

Experimental

Draws smart spacing: gap segments with end bars and a value pill, and thin alignment lines with crosses at their ends. Each marker fades in when found and out when lost, and grows from its middle. Markers are matched across calls by position, rounded to half a unit.

Feed it findSpacing on every move of a drag, a SnapEngine result through spacingFromSnap, or gaps of your own (an auto-layout container’s children through gapsBetween). Put it in screen space above the world, with space set to the world. It ignores pointer events.

Experimental: the API may change in a minor release.

Extends#

  • Container

Constructors#

Constructor#

new SpacingMarkers(options?: SpacingMarkersOptions): SpacingMarkers;

Experimental

Parameters#

ParameterType
optionsSpacingMarkersOptions

Returns#

SpacingMarkers

Overrides#

Container.constructor

Accessors#

shown#

Get Signature#

get shown(): SpacingResult;

Experimental

Markers shown now, not counting ones fading out. Allocates new arrays.

Returns

SpacingResult

Methods#

clear()#

clear(): this;

Experimental

Fades every marker out. Same as show(null).

Returns#

this


destroy()#

destroy(options?: DestroyOptions): void;

Experimental

Removes all internal references and listeners as well as removes children from the display list. Do not use a Container after calling destroy.

Parameters#

ParameterTypeDescription
options?DestroyOptionsOptions parameter. A boolean will act as if all options have been set to that value

Returns#

void

Example#

container.destroy();
container.destroy(true);
container.destroy({ children: true });
container.destroy({ children: true, texture: true, textureSource: true });

Overrides#

Container.destroy

show()#

show(result: Partial<SpacingResult> | null): this;

Experimental

Shows these markers, replacing the last call’s. Markers no longer in it fade out. null fades everything out.

Parameters#

ParameterType
resultPartial<SpacingResult> | null

Returns#

this


tick()#

tick(dt: number): boolean;

Experimental

Advances fades by dt seconds (clamped to 0..0.1) and redraws. Only needed with ticker: null.

Parameters#

ParameterType
dtnumber

Returns#

boolean