fix absolute position calculations for cached parent. close #753

This commit is contained in:
Anton Lavrenov
2019-10-08 15:19:27 -05:00
parent 201a292a89
commit 7909283e3d
5 changed files with 67 additions and 5 deletions

View File

@@ -1185,4 +1185,34 @@ suite('Caching', function() {
false
);
});
test('getAbsolutePosition for cached container', function() {
var stage = addStage();
var layer = new Konva.Layer({});
stage.add(layer);
var circle = new Konva.Circle({
x: 100,
y: 100,
radius: 10,
fill: 'red',
draggable: true,
scaleX: 10,
scaleY: 10
});
layer.add(circle);
// initial calculations
circle.getAbsolutePosition();
//
layer.cache();
layer.draw();
layer.position({
x: 10,
y: 10
});
assert.equal(circle.getAbsolutePosition().x, 110);
assert.equal(circle.getAbsolutePosition().y, 110);
});
});