Hi all,
I’m trying to render patches with holes in them. I can achieve that by adding a scatter trace for the outside edge of the patch, and a scatter trace for the inside edge of the patch, with a fill: tonext on the latest added trace.
For simple shapes, that works, but if the shapes get a bit more complicated, the hole is not cutout properly. See example:
https://codepen.io/mkatgert/pen/myVmvyM
The left shape has been created by adding the ‘hole edge’ first, and then the outer edge, and then the outer edge has a fill tonext.
The right shape follows the exact same logic, but the hole is not cut out.
Is this a bug or am I doing something wrong?
1 Like
It could be a mistake, the “d” parameter for filling is well implemented but it seems they forgot to add the fill-rule=“evenodd” parameter, I’ll leave it as homework for you.
I tried all the values for fill and none of them worked, maybe they need to add an evennod value for the fill, hopefully in future versions they will add it or maybe I could be wrong too
Thanks Saratoga. Turns out the fill algorithm is very sensitive to the direction of the polygon. In this example I reversed the direction of the hole of the right example: https://codepen.io/mkatgert/pen/YPwxvqw and then it works. The documentation might benefit from a small reference to this sensitivity.
1 Like