mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-22 07:19:57 -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}
|
* item}
|
||||||
*/
|
*/
|
||||||
isAncestor: function(item) {
|
isAncestor: function(item) {
|
||||||
var parent = item;
|
return item ? item.isDescendant(this) : false;
|
||||||
while (parent = parent._parent) {
|
|
||||||
if (parent == this)
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue