pixi-svg-graphics
pixi-svg-graphics copied to clipboard
parsing of Q (quadratic Bézier) command is missing from Path.
came across a SVG which contained the Q command in the path data. had a look in the SVG 1.1 spec and it does support it, https://www.w3.org/TR/SVG/paths.html#PathDataQuadraticBezierCommands currently missing support for this case in pixi-svg-graphics
i think this might do it,
case 'q':
for (var l = 0, llen = args.length; l < llen; l += 2) {
args[l] += offset.x
args[l + 1] += offset.y
}
this._graphics.bezierCurveTo(
lastCoord.x,
lastCoord.y,
args[0],
args[1],
args[2],
args[3]
)
lastCoord = { x: args[2], y: args[3] }
lastControl = { x: args[0], y: args[1] }
break
its not crashing, but haven't tested it properly yet. let me know if you see any obvious issues with the above.
oops more like,
case 'q':
for (var l = 0, llen = args.length; l < llen; l += 2) {
args[l] += offset.x
args[l + 1] += offset.y
}
this._graphics.bezierCurveTo(
args[0],
args[1],
args[0],
args[1],
args[2],
args[3]
)
lastCoord = { x: args[2], y: args[3] }
lastControl = { x: args[0], y: args[1] }
break