mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-08-10 21:19:10 -04:00
Find a more general implementation for Item#intersects(item).
This commit is contained in:
parent
5ddbc5b07f
commit
782bde238c
2 changed files with 22 additions and 21 deletions
src/path
|
@ -181,20 +181,9 @@ var PathItem = Item.extend(/** @lends PathItem# */{
|
|||
return locations;
|
||||
},
|
||||
|
||||
intersects: function(item, _matrix) {
|
||||
if (!(item instanceof Item))
|
||||
return false;
|
||||
var other = item instanceof PathItem
|
||||
? item
|
||||
// Create a temporary rectangular path item to check against.
|
||||
: new Path.Rectangle({
|
||||
rectangle: item.getInternalBounds(),
|
||||
insert: false
|
||||
});
|
||||
// TODO: Optimize getIntersections(): We don't need all intersections
|
||||
// when we're just curious about whether they intersect or not. Pass on
|
||||
// an argument that let's it bail out after the first intersection.
|
||||
return this.getIntersections(other, _matrix || item._matrix).length > 0;
|
||||
_asPathItem: function() {
|
||||
// See Item#_asPathItem()
|
||||
return this;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue