rough-stuff / rough

Create graphics with a hand-drawn, sketchy, appearance
http://roughjs.com
MIT License
19.83k stars 613 forks source link

Bug report: path fill bug when points value < 0 #139

Closed akira-cn closed 4 years ago

akira-cn commented 4 years ago

Rough fill seems to ignore the path coordinate < 0.

So the following code only fill half of the triangle.

const rc = rough.canvas(document.querySelector('canvas'));
const ctx = rc.ctx;
ctx.translate(150, 150);
ctx.scale(1, -1);
rc.path('M-100, 0L0 100L100 100Z', {fill: 'red'});

pshihn commented 4 years ago

I suspect it only happens when using SVG Paths and not when drawing a polygon.

akira-cn commented 4 years ago

Yes, it only happens when using SVG Paths in canvas 2d context.

pshihn commented 4 years ago

Okay I am working on a new algorithm to fill arbitrary paths. Should resolve this in a couple of days .

pshihn commented 4 years ago

Thanks for reporting this.

pshihn commented 4 years ago

This has been fixed in v4.2.0