mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Insert results of boolean operations above whichever of the two paths appear further up in the stack.
This commit is contained in:
parent
b4755ea699
commit
31771aa01d
2 changed files with 15 additions and 1 deletions
|
@ -2664,6 +2664,16 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
||||||
return item ? item.isDescendant(this) : false;
|
return item ? item.isDescendant(this) : false;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the item is an a sibling of the specified item.
|
||||||
|
*
|
||||||
|
* @param {Item} item the item to check against
|
||||||
|
* @return {Boolean} {@true if the item is aa sibling of the specified item}
|
||||||
|
*/
|
||||||
|
isSibling: function(item) {
|
||||||
|
return this._parent === item._parent;
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks whether the item is grouped with the specified item.
|
* Checks whether the item is grouped with the specified item.
|
||||||
*
|
*
|
||||||
|
|
|
@ -216,7 +216,11 @@ PathItem.inject(new function() {
|
||||||
true);
|
true);
|
||||||
// See if the CompoundPath can be reduced to just a simple Path.
|
// See if the CompoundPath can be reduced to just a simple Path.
|
||||||
result = result.reduce();
|
result = result.reduce();
|
||||||
result.insertAbove(path1);
|
// Insert the resulting path above whichever of the two paths appear
|
||||||
|
// further up in the stack.
|
||||||
|
result.insertAbove(path2 && path1.isSibling(path2)
|
||||||
|
&& path1.getIndex() < path2.getIndex()
|
||||||
|
? path2 : path1);
|
||||||
// Copy over the left-hand item's style and we're done.
|
// Copy over the left-hand item's style and we're done.
|
||||||
// TODO: Consider using Item#_clone() for this, but find a way to not
|
// TODO: Consider using Item#_clone() for this, but find a way to not
|
||||||
// clone children / name (content).
|
// clone children / name (content).
|
||||||
|
|
Loading…
Reference in a new issue