swhitty / SwiftDraw

Swift library and command line tool to convert SVGs into SFSymbol, PNG, PDF and Swift source code.
zlib License
389 stars 49 forks source link

Fixing winding when out of order #34

Closed swhitty closed 10 months ago

swhitty commented 10 months ago

This PR fixes a bug within the autowinding of subpaths for SFSymbols that I believe has always existed but was amplified by https://github.com/swhitty/SwiftDraw/pull/33.

When paths are winded, they need to be sorted into a trees to calculate which paths are "inside" other paths. The sorting code was previously relying on the outer paths being added to the tree first, the algorithm now checks if the new node should be swapped with an existing node.

Resolves #32