mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 23:12:24 -05:00
Return a promise to indicate when a costume has loaded.
Parallels the way the `addSound` method works. Needed to enable selecting new assets automatically from GUI.
This commit is contained in:
parent
ba1f217004
commit
cbebc28307
1 changed files with 2 additions and 1 deletions
|
@ -314,9 +314,10 @@ class VirtualMachine extends EventEmitter {
|
||||||
* @property {number} rotationCenterX - the X component of the costume's origin.
|
* @property {number} rotationCenterX - the X component of the costume's origin.
|
||||||
* @property {number} rotationCenterY - the Y component of the costume's origin.
|
* @property {number} rotationCenterY - the Y component of the costume's origin.
|
||||||
* @property {number} [bitmapResolution] - the resolution scale for a bitmap costume.
|
* @property {number} [bitmapResolution] - the resolution scale for a bitmap costume.
|
||||||
|
* @returns {?Promise} - a promise that resolves when the costume has been added
|
||||||
*/
|
*/
|
||||||
addCostume (md5ext, costumeObject) {
|
addCostume (md5ext, costumeObject) {
|
||||||
loadCostume(md5ext, costumeObject, this.runtime).then(() => {
|
return loadCostume(md5ext, costumeObject, this.runtime).then(() => {
|
||||||
this.editingTarget.addCostume(costumeObject);
|
this.editingTarget.addCostume(costumeObject);
|
||||||
this.editingTarget.setCostume(
|
this.editingTarget.setCostume(
|
||||||
this.editingTarget.sprite.costumes.length - 1
|
this.editingTarget.sprite.costumes.length - 1
|
||||||
|
|
Loading…
Reference in a new issue