@mocanvas/mocanvas · function

getPointsFromDrawSegment

declare function getPointsFromDrawSegment(segment: TLDrawShapeSegment, scaleX: number, scaleY: number, points?: Vec[]): Vec[]

The points of one segment, scaled by scaleX/scaleY, appended to points.

Appending into a caller-supplied array rather than returning a fresh one is what lets getPointsFromDrawSegments walk a whole stroke without allocating an array per segment; the array is returned as well, so a caller that does not care can ignore the parameter.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.