add docs, change tests

This commit is contained in:
Anton Lavrenov
2018-08-30 13:49:43 +03:00
parent 973344a3c6
commit 0a6bd95414
6 changed files with 206 additions and 15 deletions

View File

@@ -1002,12 +1002,15 @@ suite('Path', function() {
var path = new Konva.Path({
stroke: 'red',
strokeWidth: 3,
data: 'M 300,10 L 250,100 A 100 40 30 1 0 150 150 C 160,100, 290,100, 300,150'
data:
'M 300,10 L 250,100 A 100 40 30 1 0 150 150 C 160,100, 290,100, 300,150'
});
layer.add(path);
var points = [];
for (var i = 0; i < path.getLength(); i += 20) {
var p = path.getPointAtLength(i);
points.push(p);
var circle = new Konva.Circle({
x: p.x,
y: p.y,
@@ -1018,6 +1021,37 @@ suite('Path', function() {
layer.add(circle);
}
assert.deepEqual(points, [
{ x: 300, y: 10 },
{ x: 290.2871413779118, y: 27.48314552325543 },
{ x: 280.57428275582356, y: 44.96629104651086 },
{ x: 270.86142413373534, y: 62.4494365697663 },
{ x: 261.1485655116471, y: 79.93258209302172 },
{ x: 251.43570688955887, y: 97.41572761627717 },
{ x: 230.89220826660141, y: 87.23996356219386 },
{ x: 207.0639321224534, y: 74.08466390481559 },
{ x: 182.87529785963875, y: 63.52674972743341 },
{ x: 159.56025996483157, y: 56.104820499018956 },
{ x: 138.30820744216845, y: 52.197497135977514 },
{ x: 120.20328854394192, y: 52.00410710518156 },
{ x: 106.16910423342256, y: 55.53451596967142 },
{ x: 96.92159177720502, y: 62.60862410865827 },
{ x: 92.93250205472883, y: 72.86555428606191 },
{ x: 94.40533374670959, y: 85.78206137467119 },
{ x: 101.26495209131289, y: 100.69922508568548 },
{ x: 113.1614217949117, y: 116.85606400569954 },
{ x: 129.4878585660311, y: 133.42835616090537 },
{ x: 149.41138859764925, y: 149.5706857234721 },
{ x: 157.23649735164412, y: 135.43198059754286 },
{ x: 171.63472376239991, y: 124.16936108372946 },
{ x: 191.0783332798296, y: 116.67529781728555 },
{ x: 213.53990876948748, y: 112.94979079821127 },
{ x: 236.99203309692777, y: 112.99284002650663 },
{ x: 259.4072891277046, y: 116.80444550217156 },
{ x: 278.75825972737204, y: 124.3846072252061 },
{ x: 293.0175277614844, y: 135.7333251956102 }
]);
stage.add(layer);
});