Skip to content

LabelBox

Defined in: labels/cull.ts:10

A label positioned in SCREEN pixels (after the view transform is applied).

[key: string]: unknown

Carried through untouched (e.g. text, datum).

optional baseline?: LabelBaseline

Defined in: labels/cull.ts:35

Plain labels: vertical placement of the box (default "top").


optional height?: number

Defined in: labels/cull.ts:19


id: string | number

Defined in: labels/cull.ts:11


optional keepUpright?: boolean

Defined in: labels/cull.ts:38

Oriented labels only: flip 180° (and the text side) when the rotation would render the text upside down — the standard radial-tree readability flip.


optional priority?: number

Defined in: labels/cull.ts:21

Higher wins collisions; defaults to 0.


optional rotation?: number

Defined in: labels/cull.ts:29

Reading-direction angle in radians (CSS-clockwise, i.e. rotate(rotation·180/π deg)). Setting it switches the label to the ORIENTED model: text runs along the rotated axis, vertically centred on the anchor, and both the collision box and the rendered CSS transform are derived from it — so the two can never disagree. Leave undefined for an axis-aligned box placed by textAnchor/baseline.


optional textAnchor?: TextAnchor

Defined in: labels/cull.ts:33

Which way the text runs from the anchor — "start" (default) puts the anchor at the box’s left edge, "middle" centres it, "end" puts it at the right edge. Honoured by BOTH models (#204: a centred label must collide on the box it actually renders in).


optional width?: number

Defined in: labels/cull.ts:18

Box size in pixels; used for collision. Defaults to a small box if omitted.


x: number

Defined in: labels/cull.ts:15

Screen-space anchor. Where the box sits around it is declared by textAnchor / baseline (plain labels) or by rotation (oriented labels) — never by a hand-written CSS transform, so collision and render can’t disagree.


y: number

Defined in: labels/cull.ts:16