getClientRect calculation fix for groups

This commit is contained in:
Anton Lavrenov
2018-09-24 14:40:07 +03:00
parent 04222bfe93
commit c0911572e7
5 changed files with 52 additions and 9 deletions

View File

@@ -2346,6 +2346,47 @@ suite('Container', function() {
});
});
test.only('getClientRect - nested group with a hidden shapes', function() {
var stage = addStage();
var layer = new Konva.Layer();
stage.add(layer);
var group1 = new Konva.Group();
layer.add(group1);
var rect = new Konva.Rect({
x: 50,
y: 100,
width: 200,
height: 75,
fill: 'red'
});
group1.add(rect);
var group2 = new Konva.Group();
layer.add(group2);
var rect2 = new Konva.Rect({
x: 0,
y: 0,
width: 200,
height: 75,
fill: 'red',
visible: false
});
group1.add(rect2);
assert.deepEqual(layer.getClientRect(), {
x: 50,
y: 100,
width: 200,
height: 75
});
});
test('clip-cache', function() {
var stage = addStage();
var layer = new Konva.Layer();