getStage() result is now cached. refactored caching system even further.

This commit is contained in:
Eric Rowell
2013-08-11 20:34:54 -07:00
parent 8654391de4
commit d49ae15207
8 changed files with 93 additions and 90 deletions

View File

@@ -48,7 +48,7 @@ Test.Modules.Tween = {
});
},
'*tween clipping region': function(containerId) {
'tween clipping region': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,
width: 578,

View File

@@ -50,8 +50,8 @@ var tests = {
var layer = new Kinetic.Layer();
var circle = new Kinetic.Circle({
x: Math.random() * 500,
y: Math.random() * 200,
x: 43,
y: 43,
radius: 40,
fill: 'red',
stroke: 'black',
@@ -61,10 +61,10 @@ var tests = {
layer.add(circle);
stage.add(layer);
for (var n=0; n<2000; n++) {
layer.draw();
}
stop(Kinetic, test);
}

View File

@@ -152,6 +152,11 @@ Test.Modules.NODE = {
layer.draw();
test(circle.cache.listening === false, '18) circle listening cache should be primed');
// stage cache
var st = circle.getStage();
test(circle.cache.stage._id === stage._id, '19) circle stage cache should be primed');
},
'test pixel ratio toDataURL': function(containerId) {
var stage = new Kinetic.Stage({
@@ -605,8 +610,8 @@ Test.Modules.NODE = {
layer2.add(circle2);
stage.add(layer1).add(layer2);
test(layer2.isVisible(), 'layer2 should be visible');
test(layer2.isVisible(), 'layer2 should be visible');
layer2.hide();
test(!layer2.isVisible(), 'layer2 should be invisible');
test(layer2.canvas.element.style.display === 'none', 'layer canvas element display should be none');