rough-stuff / rough

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

'Leaking' hachures in nested polygons #183

Closed jwoLondon closed 2 years ago

jwoLondon commented 3 years ago

Likely related to #165 and #167: For nested holes and islands when setting combineNestedSvgPaths: true, I see leaking of the hachures at the moveTo vertex of each sub-path.

See this interactive minimal reproducible example

leakingHachures

As an aside, I only recently discovered the combineNestedSvgPaths option by looking at the source code. I couldn't see it in the API documentation. I may have missed it, but it would be nice to have the option of setting the type of fill rule (non-zero; even-odd; always).

fskpf commented 3 years ago

Any fill style is affected.

I'd love to see a fix for this. Currently, combineNestedSvgPath cannot really be used due to this.

pshihn commented 2 years ago

I'm working on improving algorithm to support this. Sorry for the late response. Infant baby = neglect open source :(

pshihn commented 2 years ago

I have it working! https://twitter.com/preetster/status/1457242142481338368?s=20 Will merge and release after some more testing

pshihn commented 2 years ago

Fixed by https://github.com/rough-stuff/rough/pull/195 Releases as v4.5.0 on npm. Note roughjs only does even-odd fills. The combineNestedSvgPaths was a stop gap hack, which is why it was not documented. That property is ignored now.