romannurik / AndroidIconAnimator

Android vector icon animation tool
Apache License 2.0
818 stars 52 forks source link

SVG importing bug with multiple 'm' and 'Z' commands #109

Open alexjlockwood opened 7 years ago

alexjlockwood commented 7 years ago

I think before the break statement here: https://github.com/romannurik/AndroidIconAnimator/blob/695b10f0bcc0775369a2d14b0c39994a31ab45f7/app/scripts/SvgPathData.js#L601

You need to keep track of a point variable lastMovePoint and add the line:

currentPoint = Object.assign({}, lastMovePoint);

Otherwise a path such as m 1,1 2,2 3,3 Z m 1,1 2,2 3,3 Z won't import properly (specifically, the second relative 'm' command will use 3,3 as its current point, when really it should be using 1,1).