Clear imageData after draw to hit canvas

This commit is contained in:
Victor Michnowicz
2014-05-08 23:27:58 -04:00
parent e6a9447867
commit 7d16ca6cca
2 changed files with 6 additions and 4 deletions

View File

@@ -47,6 +47,7 @@
clear: function(bounds) {
this.getContext().clear(bounds);
this.getHitCanvas().getContext().clear(bounds);
this.imageData = null;
return this;
},
// extend Node.prototype.setZIndex

View File

@@ -93,11 +93,11 @@
}
},
_getImageData: function(x, y) {
var width = this.hitCanvas.width,
height = this.hitCanvas.height;
var width = this.hitCanvas.width || 1,
height = this.hitCanvas.height || 1;
if (width && height && !this.imageData) {
this.imageData = this.hitCanvas.context._context.getImageData(0, 0, this.hitCanvas.width, this.hitCanvas.height);
if (!this.imageData) {
this.imageData = this.hitCanvas.context._context.getImageData(0, 0, width, height);
}
if (this.imageData && typeof x === 'number' && typeof y === 'number') {
@@ -173,6 +173,7 @@
}
Kinetic.Container.prototype.drawHit.call(this, canvas, top);
this.imageData = null;
return this;
},
/**