mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-04 03:45:58 -05:00
Fix avoiding of name clashes in cloning.
This commit is contained in:
parent
aa4d990c90
commit
949752556b
1 changed files with 3 additions and 3 deletions
|
@ -1238,13 +1238,13 @@ var Item = Base.extend(Callback, /** @lends Item# */{
|
||||||
// Copy over the selection state, use setSelected so the item
|
// Copy over the selection state, use setSelected so the item
|
||||||
// is also added to Project#selectedItems if it is selected.
|
// is also added to Project#selectedItems if it is selected.
|
||||||
copy.setSelected(this._selected);
|
copy.setSelected(this._selected);
|
||||||
|
// Insert is true by default.
|
||||||
|
if (insert || insert === undefined)
|
||||||
|
copy.insertAbove(this);
|
||||||
// Clone the name too, but make sure we're not overriding the original
|
// Clone the name too, but make sure we're not overriding the original
|
||||||
// in the same parent, by passing true for the unique parameter.
|
// in the same parent, by passing true for the unique parameter.
|
||||||
if (this._name)
|
if (this._name)
|
||||||
copy.setName(this._name, true);
|
copy.setName(this._name, true);
|
||||||
// Insert is true by default.
|
|
||||||
if (insert || insert === undefined)
|
|
||||||
copy.insertAbove(this);
|
|
||||||
return copy;
|
return copy;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue