mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Simplify Item#isAncestor() by formulating it as the reverse of Item#isDescendant().
This commit is contained in:
parent
6aac2b3e67
commit
3c2977287a
1 changed files with 1 additions and 6 deletions
|
@ -669,12 +669,7 @@ var Item = this.Item = Base.extend({
|
|||
* item}
|
||||
*/
|
||||
isAncestor: function(item) {
|
||||
var parent = item;
|
||||
while (parent = parent._parent) {
|
||||
if (parent == this)
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return item ? item.isDescendant(this) : false;
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue