Skip to content

Commit

Permalink
Merge pull request #491 from entrylabs/issue/4899
Browse files Browse the repository at this point in the history
remove scene bug fix
  • Loading branch information
chanlee authored Oct 19, 2016
2 parents 4267556 + 5d17eac commit 6f8da14
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 22 deletions.
3 changes: 2 additions & 1 deletion dist/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -7005,7 +7005,8 @@ Entry.Container.prototype.removeObject = function(b) {
this.objects_.splice(a, 1);
this.setCurrentObjects();
Entry.stage.sortZorder();
this.objects_.length && 0 !== a ? 0 < this.getCurrentObjects().length ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : Entry.container.selectObject() : this.objects_.length && 0 === a ? Entry.container.selectObject(this.getCurrentObjects()[0].id) : (Entry.container.selectObject(), Entry.playground.flushPlayground());
a = this.getCurrentObjects();
a.length ? this.selectObject(a[0].id) : (this.selectObject(), Entry.playground.flushPlayground());
Entry.toast.success(Lang.Workspace.remove_object, b.name + " " + Lang.Workspace.remove_object_msg);
Entry.variableContainer.removeLocalVariables(b.id);
Entry.playground.reloadPlayground();
Expand Down
7 changes: 3 additions & 4 deletions dist/entry.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 7 additions & 17 deletions src/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,29 +341,19 @@ Entry.Container.prototype.removeObject = function(object) {
index
);
}
var state = new Entry.State(
this.addObject,
objectJSON,
index
);
var state =
new Entry.State(this.addObject, objectJSON, index);

object.destroy();
this.objects_.splice(index, 1);
this.setCurrentObjects();
Entry.stage.sortZorder();
var currentObjects = this.getCurrentObjects();

if (this.objects_.length && index !== 0) {
// Entry.container.selectObject(this.objects_[index -1].id);
var currentObjects_ = this.getCurrentObjects();
if(currentObjects_.length > 0) {
Entry.container.selectObject(this.getCurrentObjects()[0].id);
} else {
Entry.container.selectObject();
}
}
else if (this.objects_.length && index === 0)
Entry.container.selectObject(this.getCurrentObjects()[0].id);
if (currentObjects.length)
this.selectObject(currentObjects[0].id);
else {
Entry.container.selectObject();
this.selectObject();
Entry.playground.flushPlayground();
}

Expand Down

0 comments on commit 6f8da14

Please sign in to comment.