changed isPointInShape() to intersects(). Currently the method accepts a point object, but I may extend this to also accept another shape object

This commit is contained in:
Eric Rowell
2012-04-27 20:54:49 -07:00
parent c02e7a0cee
commit 2879c0763f
5 changed files with 18 additions and 20 deletions

View File

@@ -171,10 +171,9 @@ Kinetic.Shape.prototype = {
this.data = [];
},
/**
* custom isPointInPath method which can use path detection
* or pixel detection
* determines if point is in the shape
*/
isPointInShape: function(pos) {
intersects: function(pos) {
var stage = this.getStage();
if(this.attrs.detectionType === 'path') {

View File

@@ -364,7 +364,7 @@ Kinetic.Stage.prototype = {
this.targetFound = true;
}
if(shape.attrs.visible && pos !== undefined && shape.isPointInShape(pos)) {
if(shape.attrs.visible && pos !== undefined && shape.intersects(pos)) {
// handle onmousedown
if(!isDragging && this.mouseDown) {
this.mouseDown = false;