mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
Merge pull request #718 from fsih/updateSvgStorage
Update storage when the SVG updates
This commit is contained in:
commit
ceb47bd765
1 changed files with 7 additions and 3 deletions
|
@ -400,9 +400,13 @@ class VirtualMachine extends EventEmitter {
|
|||
costume.rotationCenterY = rotationCenterY;
|
||||
this.runtime.renderer.updateSVGSkin(costume.skinId, svg, [rotationCenterX, rotationCenterY]);
|
||||
}
|
||||
// @todo: Also update storage in addition to renderer. Without storage, if you switch
|
||||
// costumes and switch back, you will lose your changes in the paint editor.
|
||||
// @todo: emitTargetsUpdate if we need to update the storage ID on the updated costume.
|
||||
const storage = this.runtime.storage;
|
||||
costume.assetId = storage.builtinHelper.cache(
|
||||
storage.AssetType.ImageVector,
|
||||
storage.DataFormat.SVG,
|
||||
(new TextEncoder()).encode(svg)
|
||||
);
|
||||
this.emitTargetsUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue