Skip to main content

Stroke

class Stroke

An immutable stroke. Create strokes with Drawing.addStroke or by drawing on a canvas.

MemberTypeDescription
idnumberUnique within the process; not persisted by serialization.
inkInkThe stroke's ink.
boundsRectBounds of the rendered stroke in content points.
pointCountnumberNumber of points; at least 1.
getPoints()StrokePoint[]Copies the stroke's points.

All members are read-only. To change a stroke, remove it and add a new one, or recolour it through a selection.

for (const stroke of drawing.getStrokes()) {
console.log(stroke.id, stroke.ink.type, stroke.pointCount)
}