mirror of
https://github.com/konvajs/konva.git
synced 2026-01-23 13:26:07 +08:00
cache fix
This commit is contained in:
@@ -1095,4 +1095,35 @@ suite('Caching', function() {
|
||||
assert.equal(stage.getIntersection({ x: 5, y: 20 }), bg);
|
||||
assert.equal(stage.getIntersection({ x: 55, y: 20 }), rect);
|
||||
});
|
||||
|
||||
it('recache should update internal caching', function() {
|
||||
var stage = addStage();
|
||||
|
||||
var layer = new Konva.Layer();
|
||||
stage.add(layer);
|
||||
|
||||
var bigCircle = new Konva.Circle({
|
||||
x: 100,
|
||||
y: 100,
|
||||
radius: 100,
|
||||
fill: 'red',
|
||||
draggable: true
|
||||
});
|
||||
layer.add(bigCircle);
|
||||
|
||||
bigCircle.cache();
|
||||
|
||||
layer.draw();
|
||||
|
||||
var d = layer.getContext().getImageData(100, 100, 1, 1).data;
|
||||
assert.equal(d[0], 255, 'see red');
|
||||
|
||||
bigCircle.fill('blue');
|
||||
bigCircle.cache();
|
||||
|
||||
layer.draw();
|
||||
d = layer.getContext().getImageData(100, 100, 1, 1).data;
|
||||
assert.equal(d[0], 0, 'no red');
|
||||
assert.equal(d[2], 255, 'see blue');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user