This repository was archived by the owner on Jul 24, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed
packages/svg-deserializer Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -947,7 +947,12 @@ sax.SAXParser.prototype.codify = function (group) {
947947 code += indent + 'var ' + pn + ' = new CSG.Path2D([[' + this . svg2cagX ( cx ) + ',' + this . svg2cagY ( cy ) + ']],false);\n'
948948 sx = cx ; sy = cy
949949 }
950- break
950+ // optional implicit relative lineTo (cf SVG spec 8.3.2)
951+ while ( pts . length >= 2 ) {
952+ cx = cx + parseFloat ( pts . shift ( ) )
953+ cy = cy + parseFloat ( pts . shift ( ) )
954+ code += indent + pn + ' = ' + pn + '.appendPoint([' + this . svg2cagX ( cx ) + ',' + this . svg2cagY ( cy ) + ']);\n'
955+ }
951956 break
952957 case 'M' : // absolute move to X,Y
953958 // close the previous path
@@ -964,6 +969,12 @@ sax.SAXParser.prototype.codify = function (group) {
964969 code += indent + 'var ' + pn + ' = new CSG.Path2D([[' + this . svg2cagX ( cx ) + ',' + this . svg2cagY ( cy ) + ']],false);\n'
965970 sx = cx ; sy = cy
966971 }
972+ // optional implicit absolute lineTo (cf SVG spec 8.3.2)
973+ while ( pts . length >= 2 ) {
974+ cx = parseFloat ( pts . shift ( ) )
975+ cy = parseFloat ( pts . shift ( ) )
976+ code += indent + pn + ' = ' + pn + '.appendPoint([' + this . svg2cagX ( cx ) + ',' + this . svg2cagY ( cy ) + ']);\n'
977+ }
967978 break
968979 case 'a' : // relative elliptical arc
969980 while ( pts . length >= 7 ) {
You can’t perform that action at this time.
0 commit comments