Merge pull request #547 from paulkaplan/fix-add-sprite-refresh

Fix sprite not drawing after being added
This commit is contained in:
Paul Kaplan 2017-04-27 12:39:59 -04:00 committed by GitHub
commit 9fce03b16f

View file

@ -184,10 +184,11 @@ class VirtualMachine extends EventEmitter {
* @param {string} json JSON string representing the sprite. * @param {string} json JSON string representing the sprite.
*/ */
addSprite2 (json) { addSprite2 (json) {
// Select new sprite.
sb2import(json, this.runtime, true).then(targets => { sb2import(json, this.runtime, true).then(targets => {
this.runtime.targets.push(targets[0]); this.runtime.targets.push(targets[0]);
this.editingTarget = targets[0]; this.editingTarget = targets[0];
this.editingTarget.updateAllDrawableProperties();
// Update the VM user's knowledge of targets and blocks on the workspace. // Update the VM user's knowledge of targets and blocks on the workspace.
this.emitTargetsUpdate(); this.emitTargetsUpdate();
this.emitWorkspaceUpdate(); this.emitWorkspaceUpdate();