Skip to content

TextData

Defined in: core/backend.ts:255

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:268

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


optional color?: string

Defined in: core/backend.ts:264

CSS fill colour. Defaults to black.


optional font?: string

Defined in: core/backend.ts:262

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


optional halo?: object

Defined in: core/backend.ts:271

A halo stroked behind the fill for legibility on busy backgrounds (the export analogue of the overlay’s text-shadow). width is the half-stroke in px.

color: string

width: number


optional opacity?: number

Defined in: core/backend.ts:266

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


text: string

Defined in: core/backend.ts:260


x: number

Defined in: core/backend.ts:258

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:259