mirror of
https://github.com/excalidraw/excalidraw.git
synced 2026-12-05 18:55:28 +03:00
* chore(packages/sloppy): vendor roughjs as @excalidraw/sloppy - port roughjs 4.6.4 with hachure-fill, path-data-parser and points-on-path into packages/sloppy - move points-on-curve and roughjs's Random into @excalidraw/math - output is identical to roughjs 4.6.4 (tests/parity.test.ts) * fix(packages/sloppy): don't change the caller's points in polygon pattern fills The fillers rotate a polygon's points in place and back, which left float drift in an element's points every time a sharp, pattern-filled line's shape was regenerated.
@excalidraw/sloppy
Hand-drawn shape generation for Excalidraw: generates sketchy shapes as op sets (Drawable) and draws them to a canvas or SVG.
Ported from roughjs 4.6.4, together with its hachure-fill, path-data-parser and points-on-path dependencies (points-on-curve lives in @excalidraw/math). See LICENSE.
The output is kept identical to roughjs 4.6.4 for the same seed and options: every existing drawing's look depends on the exact sequence of random draws. tests/parity.test.ts compares the two.
Usage
import { rough } from "@excalidraw/sloppy";
const generator = rough.generator();
const drawable = generator.ellipse(50, 50, 100, 60, { seed: 1, roughness: 1 });
rough.canvas(canvas).draw(drawable);