Select the last target instead of the first

This commit is contained in:
Paul Kaplan 2017-06-07 09:06:46 -04:00
parent ecf535f4c3
commit 40345384aa

View file

@ -379,7 +379,8 @@ class VirtualMachine extends EventEmitter {
this.runtime.disposeTarget(sprite.clones[i]); this.runtime.disposeTarget(sprite.clones[i]);
// Ensure editing target is switched if we are deleting it. // Ensure editing target is switched if we are deleting it.
if (clone === currentEditingTarget) { if (clone === currentEditingTarget) {
this.setEditingTarget(this.runtime.targets[0].id); const lastTargetIndex = this.runtime.targets.length - 1;
this.setEditingTarget(this.runtime.targets[lastTargetIndex].id);
} }
} }
// Sprite object should be deleted by GC. // Sprite object should be deleted by GC.