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
|
@ -257,13 +257,17 @@ const handleCostumeLoadError = function (costume, runtime) {
|
|||
const oldRotationX = costume.rotationCenterX;
|
||||
const oldRotationY = costume.rotationCenterY;
|
||||
|
||||
const AssetType = runtime.storage.AssetType;
|
||||
const isVector = costume.dataFormat === AssetType.ImageVector.runtimeFormat;
|
||||
|
||||
// Use default asset if original fails to load
|
||||
costume.assetId = runtime.storage.defaultAssetId.ImageVector;
|
||||
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 AssetType = runtime.storage.AssetType;
|
||||
const defaultCostumePromise = (costume.dataFormat === AssetType.ImageVector.runtimeFormat) ?
|
||||
const defaultCostumePromise = (isVector) ?
|
||||
loadVector_(costume, runtime) : loadBitmap_(costume, runtime);
|
||||
|
||||
return defaultCostumePromise.then(loadedCostume => {
|
||||
|
|
Loading…
Reference in a new issue