svg-path-commander
svg-path-commander copied to clipboard
toRelative does not convert absolute moveTo commands in additional segments
The following path string has two segments
M473.29 335.29C470.49 352.29 454.98 365.29 437.59 367.03S408.52 358.61 411.33 341.59S429.55 311.59 446.85 309.87S476 318.28 473.29 335.29Z M 452.24 337.43C454.3 324.92 454.3 313.08 446.24 313.9S434.34 326.95 432.29 339.46S430.29 363.79 438.29 362.98S450.18 349.94 452.24 337.43Z
The output of SVGPathCommander(pathString).toRelative() is:
M473.29 335.29c-2.8 17 -18.31 30 -35.7 31.74s-29.07 -8.42 -26.26 -25.44s18.22 -30 35.52 -31.72s29.15 8.41 26.44 25.42zM452.24 337.43c2.06 -12.51 2.06 -24.35 -6 -23.53s-11.9 13.05 -13.95 25.56s-2 24.33 6 23.52s11.89 -13.04 13.95 -25.55z
The second segment starts from an absolute M rather than a relative one. Is this the intended behavior?
I believe so, think how a reversed path would look like when M isn't correct M.
EDIT: don't quote me on that, I've read the code and I believe it would be possible to make it next gen perfect. The problem was some years back trying to implement the path reverse producing some horrible results and it was because M wasn't always absolute.