Skip to content

TextData

Defined in: core/backend.ts:401

One backend-rendered text label (#105 N7b-2). Positioned in screen pixels (the caller projects the world anchor and applies the view transform) and drawn at a constant pixel font, so labels stay readable at any zoom — re-pushed each setTransform, like the HTML overlay it mirrors. Drawn live by the SVG (<text>) and Canvas (fillText) backends; the WebGL backend keeps the HTML overlay on screen (GPU/MSDF text is #69) but retains the set for export (#219), so labels survive toSVG()/toPNG() on all three backends.

optional align?: "start" | "middle" | "end"

Defined in: core/backend.ts:414

Which side of x the text runs from ("start"/"middle"/"end"). Defaults to "start".


optional color?: string

Defined in: core/backend.ts:410

CSS fill colour. Defaults to black.


optional font?: string

Defined in: core/backend.ts:408

CSS font shorthand, e.g. "600 11px sans-serif". Defaults to "12px sans-serif".


optional halo?: object

Defined in: core/backend.ts:421

A halo stroked behind the fill for legibility on busy backgrounds — the same halo the WebGL overlay strokes in CSS (#571). width is the half-stroke in px; 0 draws none. Joins are miter, limited to TEXT_HALO_MITER_LIMIT.

color: string

width: number


optional opacity?: number

Defined in: core/backend.ts:412

0–1 opacity (e.g. an LOD cross-fade alpha). Defaults to 1.


optional rotation?: number

Defined in: core/backend.ts:417

Clockwise rotation in radians about (x, y) (#580): the text runs along the rotated axis, as the WebGL overlay draws an oriented label. Defaults to 0 (horizontal).


text: string

Defined in: core/backend.ts:406


x: number

Defined in: core/backend.ts:404

Screen-space anchor (CSS px). Horizontal placement relative to it follows align; the text is vertically centred on it (baseline middle).


y: number

Defined in: core/backend.ts:405