mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-23 14:32:59 -05:00
Update handleLoadCostumeError to properly handle bitmap costumes
This commit is contained in:
parent
1dfaa02c97
commit
05fa6cad3e
1 changed files with 10 additions and 6 deletions
|
@ -256,14 +256,18 @@ const handleCostumeLoadError = function (costume, runtime) {
|
|||
const oldAssetId = costume.assetId;
|
||||
const oldRotationX = costume.rotationCenterX;
|
||||
const oldRotationY = costume.rotationCenterY;
|
||||
|
||||
// Use default asset if original fails to load
|
||||
costume.assetId = runtime.storage.defaultAssetId.ImageVector;
|
||||
costume.asset = runtime.storage.get(costume.assetId);
|
||||
costume.md5 = `${costume.assetId}.${costume.dataFormat}`;
|
||||
|
||||
const AssetType = runtime.storage.AssetType;
|
||||
const defaultCostumePromise = (costume.dataFormat === AssetType.ImageVector.runtimeFormat) ?
|
||||
const isVector = costume.dataFormat === AssetType.ImageVector.runtimeFormat;
|
||||
|
||||
// Use default asset if original fails to load
|
||||
costume.assetId = isVector ?
|
||||
runtime.storage.defaultAssetId.ImageVector :
|
||||
runtime.storage.defaultAssetId.ImageBitmap;
|
||||
costume.asset = runtime.storage.get(costume.assetId);
|
||||
costume.md5 = `${costume.assetId}.${costume.dataFormat}`;
|
||||
|
||||
const defaultCostumePromise = (isVector) ?
|
||||
loadVector_(costume, runtime) : loadBitmap_(costume, runtime);
|
||||
|
||||
return defaultCostumePromise.then(loadedCostume => {
|
||||
|
|
Loading…
Reference in a new issue