Better svg parsing. fix #1549

This commit is contained in:
Anton Lavrevov
2025-08-23 14:22:39 -05:00
parent e2c0a719b9
commit 4a7ae3b671
2 changed files with 88 additions and 6 deletions

View File

@@ -487,6 +487,30 @@ describe('Path', function () {
);
});
it.only('parses arc without separators after flags', function () {
const stage = addStage();
const layer = new Konva.Layer();
stage.add(layer);
const path = new Konva.Path({
data: 'M19.5 10.5c0 7.142-7.5 11.25-7.5 11.25S4.5 17.642 4.5 10.5a7.5 7.5 0 1115 0z',
stroke: 'red',
});
layer.add(path);
layer.draw();
const arc = path.dataArray[3];
assert.equal(arc.command, 'A');
assert.closeTo(arc.points[0], 12, 0.001);
assert.closeTo(arc.points[1], 10.5, 0.001);
assert.closeTo(arc.points[2], 7.5, 0.001);
assert.closeTo(arc.points[3], 7.5, 0.001);
assert.closeTo(arc.points[4], Math.PI, 0.001);
assert.closeTo(arc.points[5], Math.PI, 0.001);
assert.equal(arc.points[6], 0);
assert.equal(arc.points[7], 1);
});
// ======================================================
it('Tiger (RAWR!)', function () {
this.timeout(5000);