mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -05:00
add get svg function
This commit is contained in:
parent
fc4f073526
commit
5f5f7b1684
1 changed files with 14 additions and 0 deletions
|
@ -340,6 +340,20 @@ class VirtualMachine extends EventEmitter {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an SVG string from the renderer.
|
||||||
|
* @param {int} costumeIndex - the index of the sound to be got.
|
||||||
|
* @return {string} the costume's SVG string, or null if it's not an SVG costume.
|
||||||
|
*/
|
||||||
|
getCostumeSVG (costumeIndex) {
|
||||||
|
const id = this.editingTarget.sprite.costumes[costumeIndex].assetId;
|
||||||
|
if (id && this.runtime && this.runtime.storage &&
|
||||||
|
this.runtime.storage.get(id).dataFormat === 'svg') {
|
||||||
|
return this.runtime.storage.get(id).decodeText();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a sound buffer.
|
* Update a sound buffer.
|
||||||
* @param {int} soundIndex - the index of the sound to be updated.
|
* @param {int} soundIndex - the index of the sound to be updated.
|
||||||
|
|
Loading…
Reference in a new issue