Merge pull request #718 from fsih/updateSvgStorage

Update storage when the SVG updates
This commit is contained in:
DD Liu 2017-10-13 19:11:41 -04:00 committed by GitHub
commit ceb47bd765

View file

@ -400,9 +400,13 @@ class VirtualMachine extends EventEmitter {
costume.rotationCenterY = rotationCenterY; costume.rotationCenterY = rotationCenterY;
this.runtime.renderer.updateSVGSkin(costume.skinId, svg, [rotationCenterX, rotationCenterY]); this.runtime.renderer.updateSVGSkin(costume.skinId, svg, [rotationCenterX, rotationCenterY]);
} }
// @todo: Also update storage in addition to renderer. Without storage, if you switch const storage = this.runtime.storage;
// costumes and switch back, you will lose your changes in the paint editor. costume.assetId = storage.builtinHelper.cache(
// @todo: emitTargetsUpdate if we need to update the storage ID on the updated costume. storage.AssetType.ImageVector,
storage.DataFormat.SVG,
(new TextEncoder()).encode(svg)
);
this.emitTargetsUpdate();
} }
/** /**