@mocanvas/editor · function

compressLegacySegments

declare function compressLegacySegments(segments: readonly (LegacyDrawShapeSegment | TLDrawShapeSegment)[]): TLDrawShapeSegment[]

Convert segments whose points are still stored as objects into packed ones.

Documents written before packing existed carry the old shape; this is what a draw shape's migration calls so those strokes are stored compactly from then on. Segments that are already packed are returned as they are, so running it twice is safe.

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.