Skip to content

PathRecorder

Defined in: core/path-recorder.ts:9

Records PathContext drawing calls into flattened polylines (subpaths). This is the retained-mode capture used by GPU backends: call a d3 generator into a PathRecorder once, then hand the subpaths to the tessellator.

new PathRecorder(tolerance?): PathRecorder

Defined in: core/path-recorder.ts:19

Flattening tolerance in coordinate units — see DEFAULT_CURVE_TOLERANCE.

number = DEFAULT_CURVE_TOLERANCE

PathRecorder

tolerance: number = DEFAULT_CURVE_TOLERANCE

Defined in: core/path-recorder.ts:19

get subpaths(): readonly Subpath[]

Defined in: core/path-recorder.ts:21

readonly Subpath[]

arc(x, y, radius, startAngle, endAngle, counterclockwise?): void

Defined in: core/path-recorder.ts:80

number

number

number

number

number

boolean = false

void

PathContext.arc


arcTo(x1, y1, x2, y2, radius): void

Defined in: core/path-recorder.ts:103

Tangent arc with Canvas-2D semantics (#86): line to the point where the circle of radius touches the segment from the current point towards (x1, y1), then sweep the short arc to where it touches the segment from (x1, y1) towards (x2, y2), leaving the current point there. The rounded-corner primitive (rounded bars, CSS-style cards). Degenerate inputs — zero radius, coincident or collinear points — draw a straight line to (x1, y1); a negative radius is an error. Retained backends bake it to a polyline once, at tolerance, so every backend draws the identical geometry.

number

number

number

number

number

void

PathContext.arcTo


beginPath(): void

Defined in: core/path-recorder.ts:25

void

PathContext.beginPath


bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y): void

Defined in: core/path-recorder.ts:65

number

number

number

number

number

number

void

PathContext.bezierCurveTo


closePath(): void

Defined in: core/path-recorder.ts:130

void

PathContext.closePath


lineTo(x, y): void

Defined in: core/path-recorder.ts:44

number

number

void

PathContext.lineTo


moveTo(x, y): void

Defined in: core/path-recorder.ts:35

number

number

void

PathContext.moveTo


quadraticCurveTo(cpx, cpy, x, y): void

Defined in: core/path-recorder.ts:57

number

number

number

number

void

PathContext.quadraticCurveTo


rect(x, y, w, h): void

Defined in: core/path-recorder.ts:121

number

number

number

number

void

PathContext.rect


translate(dx, dy): void

Defined in: core/path-recorder.ts:30

Shift all subsequent path coordinates by (dx, dy), accumulating like CanvasRenderingContext2D.translate. The canonical d3 idiom for placing an origin-centred generator (radial trees, chords, …) at an offset: call translate(cx, cy) once, then run the generator into this context unchanged.

This is the only transform in the seam — no rotate/scale/save/restore. Radial generators bake angle into their coordinates, so a translation is all they need; a richer transform stack would complicate every backend for no current consumer. The offset is part of context state (not reset by beginPath) and, in retained backends, lives only for the single drawable the callback is recording.

number

number

void

PathContext.translate