some refactoring proposed by pavelpower

This commit is contained in:
Eric Rowell
2013-04-07 10:00:55 -07:00
parent d8d724dd60
commit 6f61b07500
3 changed files with 9 additions and 6 deletions

View File

@@ -225,7 +225,9 @@
},
drawHit: function() {
var clip = !!this.getClipFunc() && this.nodeType !== 'Stage',
dd = Kinetic.DD,
n = 0,
len = 0,
children = [],
hitCanvas;
if(this.shouldDrawHit()) {
@@ -233,8 +235,11 @@
hitCanvas = this.getLayer().hitCanvas;
hitCanvas._clip(this);
}
var children = this.children, len = children.length;
for(var n = 0; n < len; n++) {
children = this.children;
len = children.length;
for(n = 0; n < len; n++) {
children[n].drawHit();
}
if (clip) {

View File

@@ -17,8 +17,6 @@
Kinetic.Layer.prototype = {
_initLayer: function(config) {
this.nodeType = 'Layer';
this.beforeDrawFunc = undefined;
this.afterDrawFunc = undefined;
this.canvas = new Kinetic.SceneCanvas();
this.canvas.getElement().style.position = 'absolute';
this.hitCanvas = new Kinetic.HitCanvas();

View File

@@ -155,7 +155,7 @@
// stop DD
if(dd && dd.node && dd.node._id === this._id) {
node._endDrag();
this._endDrag();
}
// stop transition