diff --git a/dist/entry.js b/dist/entry.js index 846e95a2ef..0e16a34ce7 100644 --- a/dist/entry.js +++ b/dist/entry.js @@ -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(); diff --git a/dist/entry.min.js b/dist/entry.min.js index a928020749..73cf875aeb 100644 --- a/dist/entry.min.js +++ b/dist/entry.min.js @@ -774,10 +774,9 @@ Entry.Container.prototype.selectPicture=function(b,a){var d=this.getObject(a),c= Entry.Container.prototype.addObject=function(b,a){var d=new Entry.EntryObject(b);d.name=Entry.getOrderedName(d.name,this.objects_);Entry.stateManager&&Entry.stateManager.addCommand("add object",this,this.removeObject,d);d.scene||(d.scene=Entry.scene.selectedScene);"number"==typeof a?b.sprite.category&&"background"==b.sprite.category.main?(d.setLock(!0),this.objects_.push(d)):this.objects_.splice(a,0,d):b.sprite.category&&"background"==b.sprite.category.main?this.objects_.push(d):this.objects_.unshift(d); d.generateView();d.pictures.map(function(a){Entry.playground.generatePictureElement(a)});d.sounds.map(function(a){Entry.playground.generateSoundElement(a)});this.setCurrentObjects();this.updateObjectsOrder();this.updateListView();this.selectObject(d.id);Entry.variableContainer.updateViews();return new Entry.State(this,this.removeObject,d)}; Entry.Container.prototype.addCloneObject=function(b,a){var d=b.toJSON(),c=Entry.generateHash();Entry.variableContainer.addCloneLocalVariables({objectId:d.id,newObjectId:c,json:d});d.id=c;d.scene=a||Entry.scene.selectedScene;this.addObject(d)}; -Entry.Container.prototype.removeObject=function(b){var a=this.objects_.indexOf(b),d=b.toJSON();Entry.stateManager&&Entry.stateManager.addCommand("remove object",this,this.addObject,d,a);d=new Entry.State(this.addObject,d,a);b.destroy();this.objects_.splice(a,1);this.setCurrentObjects();Entry.stage.sortZorder();this.objects_.length&&0!==a?0 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(); }