diff --git a/lib/svgpath.js b/lib/svgpath.js index bc6d50e..857d136 100644 --- a/lib/svgpath.js +++ b/lib/svgpath.js @@ -496,6 +496,11 @@ SvgPath.prototype.unarc = function () { nextY = s[7]; } + // one of the radii is zero, treating it as a line segment instead + if (s[1] === 0 || s[2] === 0) { + return [ [ 'L', nextX, nextY ] ]; + } + new_segments = a2c(x, y, nextX, nextY, s[4], s[5], s[1], s[2], s[3]); new_segments.forEach(function (s) { diff --git a/test/api.js b/test/api.js index 0db26bc..c3aa0b8 100644 --- a/test/api.js +++ b/test/api.js @@ -491,13 +491,13 @@ describe('API', function () { // both rx and ry are zero assert.equal( svgpath('M100 100A0 0 0 0 1 110 110').unarc().round(0).toString(), - 'M100 100' + 'M100 100L110 110' ); // rx is zero assert.equal( svgpath('M100 100A0 100 0 0 1 110 110').unarc().round(0).toString(), - 'M100 100' + 'M100 100L110 110' ); }); });