mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Merge pull request #846 from iconexperience/reduce-fix
Make sure reduced item has no parent if original item had no parent. Fix for #835
This commit is contained in:
parent
b987590c71
commit
fec67617e1
1 changed files with 6 additions and 1 deletions
|
@ -2325,7 +2325,12 @@ var Item = Base.extend(Emitter, /** @lends Item# */{
|
|||
reduce: function() {
|
||||
if (this._children && this._children.length === 1) {
|
||||
var child = this._children[0].reduce();
|
||||
child.insertAbove(this);
|
||||
// make sure that reduced item has same parent as original
|
||||
if (this.parent) {
|
||||
child.insertAbove(this);
|
||||
} else {
|
||||
child.remove();
|
||||
}
|
||||
child.copyAttributes(this);
|
||||
this.remove();
|
||||
return child;
|
||||
|
|
Loading…
Reference in a new issue