savage icon indicating copy to clipboard operation
savage copied to clipboard

Subpath .to_command bug

Open k2m30 opened this issue 10 years ago • 0 comments

'm' command, followed by 'L' command in SVG paths doesn't work properly. It becomes 'm' followed by 'l' command instead. Which causes problems.

Example (just an image created with Inkscape):

d = "m 355.71875,277.53125 -0.125,0.0312 -178.9375,47.96875 -1.8125,0.46875 1.8125,0.5 311.625,83.5 0.15625,0.0312 0.125,-0.0625 157.59375,-53.65625 1.5625,-0.53125 -1.59375,-0.4375 -290.28125,-77.78125 -0.125,-0.0312 z m 0,1.03125 L 644.3125,355.90625 488.375,409 178.71875,326 l 177,-47.4375 z"
path = Savage::Parser.parse d
path.to_command
=> "M355.71875 277.53125l-0.125 0.0312-178.9375 47.96875-1.8125 0.46875 1.8125 0.5 311.625 83.5 0.15625 0.0312 0.125-0.0625 157.59375-53.65625 1.5625-0.53125-1.59375-0.4375-290.28125-77.78125-0.125-0.0312zm0 1.03125 644.3125 355.90625 488.375 409 178.71875 326l177-47.4375z"

Second subpath is wrong. "m 0,1.03125 L 644.3125,355.90625" becomes "m 0,1.03125 644.3125,355.90625"

k2m30 avatar May 31 '14 13:05 k2m30