@mocanvas/mocanvas · function

readDrawSegments

declare function readDrawSegments(shape: {
    props?: unknown;
}): DrawSegment[]

The shape's segments in a usable form.

points comes in two shapes and both are ours. A document written long-hand carries an array of {x, y, z}; a compressed one carries the packed base64 string that b64Vecs produces and that TLDrawShapeSegment declares — which is what compressLegacySegments writes and what a .tldr file holds.

Only the array was read. The string fell through the array reader as empty, so a compressed segment contributed no points, and a draw shape written by this very library came back with no geometry and drew nothing at all — silently, because an unreadable segment is meant to cost its own run and not throw. Failing soft is right; failing soft on a format we author ourselves is not, and that is what hid it.

A segment that is neither still reads as an empty run.

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.