mirror of
https://github.com/konvajs/konva.git
synced 2025-09-19 02:37:59 +08:00
Better svg parsing. fix #1549
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user