Skip to content

1681-engine / ui / DomWorldAnchors

Class: DomWorldAnchors ​

Defined in: src/ui/dom/DomWorldAnchors.ts:44

DOM elements that follow points in the world (names over heads, speech bubbles, markers): placed every frame through the world layer's own transform, on whole CSS pixels, and hidden off screen. A style is written only when the rounded position or visibility changed, so a still crowd costs no DOM writes.

Constructors ​

Constructor ​

ts
new DomWorldAnchors(overlay, layer): DomWorldAnchors;

Defined in: src/ui/dom/DomWorldAnchors.ts:49

Parameters ​

ParameterTypeDescription
overlayDomOverlay-
layerLayerTransformThe layer the points are in: engine.stage.world.

Returns ​

DomWorldAnchors

Methods ​

add() ​

ts
add(
   el, 
   target, 
   options?
): () => void;

Defined in: src/ui/dom/DomWorldAnchors.ts:56

Places el (put inside the overlay's content if it is not already there) on target. Returns the remover.

Parameters ​

ParameterType
elHTMLElement
targetWorldPoint
optionsWorldAnchorOptions

Returns ​

() => void


attach() ​

ts
attach(ticker): () => void;

Defined in: src/ui/dom/DomWorldAnchors.ts:87

Runs update on ticker after Pixi renders (UTILITY priority), so it reads the camera as this frame drew it, shake included. The returned function stops it.

Parameters ​

ParameterType
tickerTicker

Returns ​

() => void


destroy() ​

ts
destroy(): void;

Defined in: src/ui/dom/DomWorldAnchors.ts:121

Returns ​

void


detach() ​

ts
detach(): void;

Defined in: src/ui/dom/DomWorldAnchors.ts:94

Returns ​

void


remove() ​

ts
remove(el): void;

Defined in: src/ui/dom/DomWorldAnchors.ts:78

Parameters ​

ParameterType
elHTMLElement

Returns ​

void


update() ​

ts
update(): void;

Defined in: src/ui/dom/DomWorldAnchors.ts:100

Places every element for this frame.

Returns ​

void

Released under the MIT License.