when using pixel detection, clear shape data whenever shape is drawn

This commit is contained in:
Eric Rowell 2012-04-04 19:53:11 -07:00
parent 2dff730081
commit dc45f5e2d6
5 changed files with 19 additions and 9 deletions

View File

@ -3,7 +3,7 @@
* http://www.kineticjs.com/
* Copyright 2012, Eric Rowell
* Licensed under the MIT or GPL Version 2 licenses.
* Date: Apr 03 2012
* Date: Apr 04 2012
*
* Copyright (C) 2011 - 2012 by Eric Rowell
*
@ -1948,7 +1948,7 @@ Kinetic.Shape.prototype = {
this.drawFunc = func;
},
/**
* save shape data when using pixel detection.
* save shape data when using pixel detection.
*/
save: function() {
var stage = this.getStage();
@ -1995,6 +1995,11 @@ Kinetic.Shape.prototype = {
this.drawFunc.call(this);
context.restore();
}
// clear shape data
if(this.detectionType === 'pixel') {
this.data = [];
}
},
/**
* custom isPointInPath method which can use path detection

File diff suppressed because one or more lines are too long

View File

@ -146,7 +146,7 @@ Kinetic.Shape.prototype = {
this.drawFunc = func;
},
/**
* save shape data when using pixel detection.
* save shape data when using pixel detection.
*/
save: function() {
var stage = this.getStage();
@ -193,6 +193,11 @@ Kinetic.Shape.prototype = {
this.drawFunc.call(this);
context.restore();
}
// clear shape data
if(this.detectionType === 'pixel') {
this.data = [];
}
},
/**
* custom isPointInPath method which can use path detection

View File

@ -10,7 +10,7 @@ function log(message) {
* Test constructor
*/
function Test() {
this.testOnly = '';
this.testOnly = 'EVENTS - star pixel detection';
this.counter = 0;
}
/**

View File

@ -28,8 +28,8 @@ Test.prototype.tests = {
});
},
'TRANSITION - all transition types': function(containerId) {
document.getElementById(containerId).style.height = '300px';
document.getElementById(containerId).style.height = '300px';
var stage = new Kinetic.Stage({
container: containerId,
width: 578,