refactored draw, _draw, and _drawChildren methods in such a way that isVisible and getListening logic resides in one place, therefore improving code quality

This commit is contained in:
Eric Rowell
2012-08-19 20:44:45 -07:00
parent e99312ece2
commit 9093d9a512
11 changed files with 101 additions and 152 deletions

View File

@@ -363,6 +363,8 @@ Test.prototype.tests = {
layer.add(star);
stage.add(layer);
//document.body.appendChild(layer.bufferCanvas.element)
},
'EVENTS - drag events click': function(containerId) {
var stage = new Kinetic.Stage({

View File

@@ -67,7 +67,7 @@ Test.prototype.tests = {
anim.start();
}, 4000);
},
'*DRAWING - draw 10,000 small circles with tooltips': function(containerId) {
'DRAWING - draw 10,000 small circles with tooltips': function(containerId) {
var stage = new Kinetic.Stage({
container: containerId,
width: 578,

View File

@@ -130,7 +130,7 @@ Test.prototype.tests = {
test(circle.getName() === 'myCircle', 'circle name should be myCircle');
//document.body.appendChild(layer.bufferCanvas.element)
document.body.appendChild(layer.bufferCanvas.element)
},
'STAGE - add shape with opacity': function(containerId) {
var stage = new Kinetic.Stage({
@@ -480,7 +480,6 @@ Test.prototype.tests = {
test(stage.getScale().x === 0.5, 'stage scale x should be 0.5');
test(stage.getScale().y === 0.5, 'stage scale y should be 0.5');
stage.draw();
},
'STAGE - scale stage before add shape': function(containerId) {
@@ -1882,11 +1881,17 @@ Test.prototype.tests = {
y: -120
});
layer.add(cachedShape);
layer.draw();
warn(urls[0] === layer.toDataURL(), 'layer data url is incorrect');
cachedShape.createBufferImage(function() {
layer.draw();
warn(urls[0] === layer.toDataURL(), 'layer data url is incorrect');
document.body.appendChild(layer.bufferCanvas.element)
});
}
});