no longer auto clearing shape data. added new shape.clearData() method instead

This commit is contained in:
Eric Rowell
2012-04-08 20:25:31 -07:00
parent 30e8973956
commit 63c8dde6d5
4 changed files with 48 additions and 46 deletions

View File

@@ -155,7 +155,7 @@ Kinetic.Shape.prototype = {
/**
* save shape data when using pixel detection.
*/
save: function() {
saveData: function() {
var stage = this.getStage();
var w = stage.attrs.width;
var h = stage.attrs.height;
@@ -169,6 +169,12 @@ Kinetic.Shape.prototype = {
var imageData = bufferLayerContext.getImageData(0, 0, w, h);
this.data = imageData.data;
},
/**
* clear shape data
*/
clearData: function() {
this.data = [];
},
/**
* draw shape
* @param {Layer} layer Layer that the shape will be drawn on
@@ -200,11 +206,6 @@ Kinetic.Shape.prototype = {
this.drawFunc.call(this);
context.restore();
}
// clear shape data
if(this.attrs.detectionType === 'pixel') {
this.data = [];
}
},
/**
* custom isPointInPath method which can use path detection