fix regular polygin size calculations. close #1015

This commit is contained in:
Anton Lavrenov
2020-11-17 14:08:43 -05:00
parent cc5a3eb220
commit 0e2a09ba46
4 changed files with 151 additions and 1335 deletions

View File

@@ -167,4 +167,36 @@ suite('RegularPolygon', function () {
cloneAndCompareLayer(layer, 254);
Konva.pixelRatio = undefined;
});
test.only('triangle - bounding box', function () {
var stage = addStage();
var layer = new Konva.Layer();
stage.add(layer);
var poly = new Konva.RegularPolygon({
x: 200,
y: 100,
sides: 3,
radius: 50,
fill: 'green',
stroke: 'blue',
strokeWidth: 5,
name: 'foobar',
});
layer.add(poly);
var tr = new Konva.Transformer({
nodes: [poly],
});
layer.add(tr);
layer.draw();
var box = poly.getClientRect();
assert.equal(box.width, 92.60254037844388);
assert.equal(box.height, 81.00000000000003);
});
});