Skip to content

Documentation / @ripl/terminal / TerminalPath

Class: TerminalPath ​

Defined in: terminal/src/path.ts:37

Terminal path implementation that records drawing commands for later rasterization.

Extends ​

Constructors ​

Constructor ​

new TerminalPath(id?): TerminalPath

Defined in: terminal/src/path.ts:48

Parameters ​

ParameterType
id?string

Returns ​

TerminalPath

Overrides ​

ContextPath.constructor

Properties ​

PropertyModifierTypeDefault valueDescriptionInherited fromDefined in
commandsreadonlyTerminalPathCommand[][]Ordered list of recorded drawing commands, replayed during rasterization.-terminal/src/path.ts:40
idreadonlystringundefinedUnique identifier for this path, used for SVG element diffing between frames.ContextPath.idcore/src/context/path.ts:20

Methods ​

addPath() ​

addPath(path): void

Defined in: terminal/src/path.ts:250

Appends the recorded commands of another TerminalPath to this path. A path from another backend carries no terminal commands to replay, so it is skipped with a warning rather than composing into a silently empty result.

Parameters ​

ParameterType
pathContextPath

Returns ​

void

Overrides ​

ContextPath.addPath


arc() ​

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

Defined in: terminal/src/path.ts:64

Records an arc centered at (x, y) sweeping from startAngle to endAngle.

Parameters ​

ParameterType
xnumber
ynumber
radiusnumber
startAnglenumber
endAnglenumber
counterclockwise?boolean

Returns ​

void

Overrides ​

ContextPath.arc


arcTo() ​

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

Defined in: terminal/src/path.ts:86

Records the arc of the given radius tangent to both the line from the current point to (x1, y1) and the line from (x1, y1) to (x2, y2), preceded by a line to the first tangent point — the same construction canvas performs, so the corner point itself is not visited. Degenerate cases (a zero radius, or three collinear points) fall back to a line to (x1, y1).

Parameters ​

ParameterType
x1number
y1number
x2number
y2number
radiusnumber

Returns ​

void

Overrides ​

ContextPath.arcTo


bezierCurveTo() ​

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

Defined in: terminal/src/path.ts:124

Records a cubic bezier curve from the current point to (x, y).

Parameters ​

ParameterType
cp1xnumber
cp1ynumber
cp2xnumber
cp2ynumber
xnumber
ynumber

Returns ​

void

Overrides ​

ContextPath.bezierCurveTo


circle() ​

circle(x, y, radius): void

Defined in: terminal/src/path.ts:76

Records a full circle centered at (x, y) as a complete arc.

Parameters ​

ParameterType
xnumber
ynumber
radiusnumber

Returns ​

void

Overrides ​

ContextPath.circle


closePath() ​

closePath(): void

Defined in: terminal/src/path.ts:137

Closes the current subpath with a line back to its start point.

Returns ​

void

Overrides ​

ContextPath.closePath


ellipse() ​

ellipse(x, y, radiusX, radiusY, rotation, startAngle, endAngle, counterclockwise?): void

Defined in: terminal/src/path.ts:149

Records an ellipse centered at (x, y) with the given radii, sweep, and rotation.

Parameters ​

ParameterType
xnumber
ynumber
radiusXnumber
radiusYnumber
rotationnumber
startAnglenumber
endAnglenumber
counterclockwise?boolean

Returns ​

void

Overrides ​

ContextPath.ellipse


lineTo() ​

lineTo(x, y): void

Defined in: terminal/src/path.ts:162

Records a straight line from the current point to (x, y).

Parameters ​

ParameterType
xnumber
ynumber

Returns ​

void

Overrides ​

ContextPath.lineTo


moveTo() ​

moveTo(x, y): void

Defined in: terminal/src/path.ts:175

Moves the cursor to (x, y), starting a new subpath.

Parameters ​

ParameterType
xnumber
ynumber

Returns ​

void

Overrides ​

ContextPath.moveTo


polyline() ​

polyline(points): void

Defined in: core/src/context/path.ts:82

Adds a connected series of straight line segments through the given points.

Parameters ​

ParameterType
pointsPoint[]

Returns ​

void

Inherited from ​

ContextPath.polyline


quadraticCurveTo() ​

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

Defined in: terminal/src/path.ts:203

Records a quadratic bezier curve from the current point to (x, y).

Parameters ​

ParameterType
cpxnumber
cpynumber
xnumber
ynumber

Returns ​

void

Overrides ​

ContextPath.quadraticCurveTo


rect() ​

rect(x, y, width, height): void

Defined in: terminal/src/path.ts:189

Records an axis-aligned rectangle with its top-left corner at (x, y).

Parameters ​

ParameterType
xnumber
ynumber
widthnumber
heightnumber

Returns ​

void

Overrides ​

ContextPath.rect


roundRect() ​

roundRect(x, y, width, height, radii?): void

Defined in: terminal/src/path.ts:216

Records a rounded rectangle, tracing each corner as a quarter arc between the straight edges.

Parameters ​

ParameterType
xnumber
ynumber
widthnumber
heightnumber
radii?BorderRadius

Returns ​

void

Overrides ​

ContextPath.roundRect