SvgPathContext
Defined in: svg/svg-context.ts:18
A PathContext that accumulates an SVG path d string. Used for publication
vector export: re-run a d3 generator (geoPath, d3-shape, …) into this context
and read toPath(). Curves map to native C/Q commands; arcs are flattened to
line segments (correct geometry; geo export is polygons/lines, so this is rare).
tolerance controls only arc flattening and is independent of a PathRecorder’s
tolerance — pass the same value if you need the SVG arc density to match the GPU.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SvgPathContext(
tolerance?):SvgPathContext
Defined in: svg/svg-context.ts:25
Parameters
Section titled “Parameters”tolerance?
Section titled “tolerance?”number = 0.25
Returns
Section titled “Returns”SvgPathContext
Properties
Section titled “Properties”tolerance
Section titled “tolerance”tolerance:
number=0.25
Defined in: svg/svg-context.ts:25
Methods
Section titled “Methods”arc(
x,y,radius,startAngle,endAngle,counterclockwise?):void
Defined in: svg/svg-context.ts:56
Parameters
Section titled “Parameters”number
number
radius
Section titled “radius”number
startAngle
Section titled “startAngle”number
endAngle
Section titled “endAngle”number
counterclockwise?
Section titled “counterclockwise?”boolean = false
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”arcTo()
Section titled “arcTo()”arcTo(
x1,y1,x2,y2,_radius):void
Defined in: svg/svg-context.ts:66
Parameters
Section titled “Parameters”number
number
number
number
_radius
Section titled “_radius”number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”beginPath()
Section titled “beginPath()”beginPath():
void
Defined in: svg/svg-context.ts:31
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”bezierCurveTo()
Section titled “bezierCurveTo()”bezierCurveTo(
cp1x,cp1y,cp2x,cp2y,x,y):void
Defined in: svg/svg-context.ts:52
Parameters
Section titled “Parameters”number
number
number
number
number
number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”closePath()
Section titled “closePath()”closePath():
void
Defined in: svg/svg-context.ts:78
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”lineTo()
Section titled “lineTo()”lineTo(
x,y):void
Defined in: svg/svg-context.ts:44
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”moveTo()
Section titled “moveTo()”moveTo(
x,y):void
Defined in: svg/svg-context.ts:40
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”quadraticCurveTo()
Section titled “quadraticCurveTo()”quadraticCurveTo(
cpx,cpy,x,y):void
Defined in: svg/svg-context.ts:48
Parameters
Section titled “Parameters”number
number
number
number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”rect()
Section titled “rect()”rect(
x,y,w,h):void
Defined in: svg/svg-context.ts:72
Parameters
Section titled “Parameters”number
number
number
number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”toPath()
Section titled “toPath()”toPath():
string
Defined in: svg/svg-context.ts:27
Returns
Section titled “Returns”string
translate()
Section titled “translate()”translate(
dx,dy):void
Defined in: svg/svg-context.ts:35
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.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”void