add path test

This commit is contained in:
Anton Lavrenov 2019-11-20 13:46:52 -05:00
parent ca1ccdaf82
commit de9a0e24e0
3 changed files with 32 additions and 0 deletions

View File

@ -10832,6 +10832,7 @@
]);
}
else {
// TODO: how can we calculate bezier curves better?
points = points.concat(data.points);
}
});

View File

@ -111,6 +111,7 @@ export class Path extends Shape<PathConfig> {
data.points[1] + data.points[3]
])
} else {
// TODO: how can we calculate bezier curves better?
points = points.concat(data.points);
}
});

View File

@ -1182,6 +1182,36 @@ suite('Path', function() {
assert.deepEqual(rect, {x: 8, y: 65, width: 95, height: 56});
});
test.skip('getClientRect of another complex path', function() {
var stage = addStage();
var layer = new Konva.Layer();
stage.add(layer);
var path = new Konva.Path({
x: 50,
y: 50,
data:
'M0,29 C71,-71,142,128,213,29 L213,207 C142,307,71,108,0,207 L0,29 Z',
fill: 'black',
stroke: 'red',
scaleY: 0.3
});
layer.add(path);
var rect = path.getClientRect();
var back = new Konva.Rect({
x: rect.x,
y: rect.y,
width: rect.width,
height: rect.height,
stroke: 'red'
});
layer.add(back);
layer.draw();
assert.deepEqual(rect, {x: 8, y: 65, width: 95, height: 56});
});
test('getClientRect for arc', function() {
var stage = addStage();
var layer = new Konva.Layer();