new hit detection algo works with images that contain transparent pixels. Devs will need to use the createImageBuffer() method to create a higher precision buffer image

This commit is contained in:
Eric Rowell
2012-08-18 22:02:16 -07:00
parent f53c43d4f7
commit f944409a1e
10 changed files with 159 additions and 138 deletions

View File

@@ -350,7 +350,6 @@ Test.prototype.tests = {
fill: 'green',
stroke: 'blue',
strokeWidth: 20,
detectionType: 'pixel',
draggable: true
});
@@ -362,13 +361,8 @@ Test.prototype.tests = {
log('mouseout');
});
star.on('dragend', function() {
this.saveImageData();
});
layer.add(star);
stage.add(layer);
star.saveImageData();
},
'EVENTS - drag events click': function(containerId) {
var stage = new Kinetic.Stage({
@@ -799,7 +793,6 @@ Test.prototype.tests = {
fill: 'red',
stroke: 'black',
strokeWidth: 4,
//detectionType: 'pixel'
});
Ellipse.setDraggable(true);
@@ -812,7 +805,6 @@ Test.prototype.tests = {
stroke: 'black',
strokeWidth: 4,
draggable: true
//detectionType: 'pixel'
});
/*

View File

@@ -1986,12 +1986,6 @@ Test.prototype.tests = {
layer.add(line);
stage.add(layer);
line.saveImageData();
line.on('dragend', function() {
line.saveImageData();
});
line.setPoints([1, 2, 3, 4]);
test(line.getPoints()[0].x === 1, 'first point x should be 1');
@@ -2362,7 +2356,7 @@ Test.prototype.tests = {
height: 200
});
var layer = new Kinetic.Layer();
var darth = new Kinetic.Image({
var lion = new Kinetic.Image({
x: 200,
y: 40,
image: imageObj,
@@ -2375,11 +2369,14 @@ Test.prototype.tests = {
}
});
layer.add(darth);
stage.add(layer);
layer.add(lion);
lion.createBufferImage(function() {
stage.add(layer);
});
//document.body.appendChild(layer.bufferCanvas.element);
};
imageObj.src = '../assets/lion.png';
imageObj.src = '../assets/lion.png';
},
'SHAPE - custom shape with fill, stroke, and strokeWidth': function(containerId) {
var stage = new Kinetic.Stage({