mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-05 20:32:00 -05:00
Check result from removeFromParent().
This commit is contained in:
parent
59e2783979
commit
2f6fbcba74
2 changed files with 3 additions and 4 deletions
|
@ -804,8 +804,7 @@ var Item = this.Item = Base.extend({
|
|||
|
||||
function append(top) {
|
||||
return function(item) {
|
||||
if (this.children) {
|
||||
item.removeFromParent();
|
||||
if (this.children && item.removeFromParent()) {
|
||||
this.children.splice(top ? this.children.length : 0, 0, item);
|
||||
// TODO: Reassign _index
|
||||
item.parent = this;
|
||||
|
|
|
@ -57,8 +57,8 @@ var Layer = this.Layer = Group.extend({
|
|||
function move(above) {
|
||||
return function(item) {
|
||||
// if the item is a layer and contained within Document#layers
|
||||
if (item instanceof Layer && !item.parent) {
|
||||
this.removeFromParent();
|
||||
if (item instanceof Layer && !item.parent
|
||||
&& this.removeFromParent()) {
|
||||
item._document.layers.splice(item.getIndex() + (above ? 1 : -1),
|
||||
0, this);
|
||||
this.setDocument(item._document);
|
||||
|
|
Loading…
Reference in a new issue