Skip to content

LabelLayer

Defined in: labels/label-layer.ts:122

An HTML overlay of absolutely-positioned label elements. On each update it maps reference anchors through the view transform to screen pixels, culls to the viewport with collision resolution, and reconciles the DOM (reusing nodes by id). Geometry stays on the GPU; only the surviving labels are in the DOM.

The container should be positioned (e.g. position: relative) and overlay the canvas; label nodes are position: absolute.

new LabelLayer(container, text, className?, style?): LabelLayer

Defined in: labels/label-layer.ts:125

HTMLElement

(anchor) => string

string

Optional class set on each label element, for styling the overlay (font, colour, halo).

LabelStyle

Optional inline CSS set on each label element, applied ONCE at creation — never on the per-transform update path. Applied as given: engine callers pass the default-merged result of resolveLabelStyle; omitted, elements inherit from the container as before.

LabelLayer

destroy(): void

Defined in: labels/label-layer.ts:187

void


update(anchors, transform, viewport): void

Defined in: labels/label-layer.ts:136

readonly LabelAnchor[]

ViewTransform

number

number

void