rough-stuff/rough

Holes in paths are filled

kevinzwang opened this issue · 2 comments

Hello!

I'm drawing some paths with RoughJS that holes. For example:
image

However, when I try to fill them, the holes are filled as well, in fact they're filled in twice, once by the outer path and once by the inner path.
image

I did some more digging and in the examples page, the second example looks like it has a rectangle at the top left corner that has a hole that is correctly unfilled, but if you click on the links to view on Glitch, that rectangle is rendered with the same behavior I have been seeing myself, with a filled hole. This seems to indicate that this was a feature that worked before but has since broke.

Would greatly appreciate a fix to this.

Yes something changed recently. So now if your PATH is actually composed of multiple disconnect paths, like in your case, you need to set combineNestedSvgPaths: true in the options.
I have updated the Glitch

e.g.

rc.path('M37,17v15H14V17z M50,5H5v50h45z', {
      stroke: 'red',
      strokeWidth: '1',
      fill: 'blue',
      combineNestedSvgPaths: true
});

Awesome. thanks!