fix cache with invisble shapes

This commit is contained in:
Anton Lavrenov
2021-05-27 20:04:30 -05:00
parent 19de9c40ba
commit 38b2501e4b
2 changed files with 40 additions and 3 deletions

View File

@@ -902,6 +902,42 @@ describe('Caching', function () {
assert.equal(stage.getIntersection({ x: 150, y: 100 }), rect);
});
it('check cache for invisible shape', function () {
var stage = addStage();
var layer = new Konva.Layer({
// visible: false,
});
var group = new Konva.Group();
layer.add(group);
group.add(
new Konva.Rect({
x: 50,
y: 50,
width: 100,
height: 100,
fill: 'red',
})
);
var rect = new Konva.Rect({
x: 0,
y: 0,
width: 100,
height: 100,
fill: 'green',
visible: false,
});
group.add(rect);
stage.add(layer);
group.cache();
layer.draw();
cloneAndCompareLayer(layer);
});
it('even if parent is not listening cache and hit should be created', function () {
var stage = addStage();