Pomax / svg-path-reverse

This is a JavaScript SVG path to "something" converter, turning a path into hookable graphics instructions for arbitrary conversion
59 stars 15 forks source link

fix arc parsing wrt flags #5

Closed Pomax closed 4 years ago

Pomax commented 4 years ago

SVG: a 5.5 5.5 0 100 11 z must follow the grammar for {letter, number, number, number, flag, flag, number, number}, which means the 100 component should be treated as "flag:1 flag:0 number:0 number:11".

From the spec:

elliptical_arc::=
    ( "A" | "a" ) wsp* elliptical_arc_argument_sequence

elliptical_arc_argument_sequence::=
    elliptical_arc_argument
    | (elliptical_arc_argument comma_wsp? elliptical_arc_argument_sequence)

elliptical_arc_argument::=
    number comma_wsp? number comma_wsp? number comma_wsp
    flag comma_wsp? flag comma_wsp? coordinate_pair

...

sign::= "+"|"-"
number ::= ([0-9])+
flag::=("0"|"1")
comma_wsp::=(wsp+ ","? wsp*) | ("," wsp*)
wsp ::= (#x9 | #x20 | #xA | #xC | #xD)

Target: normalization should turn this into A 5.5 5.5 0 1 0 0 11 Z

Pomax commented 4 years ago

fixed as of 1.2.1