mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 23:12:24 -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 oldRotationX = costume.rotationCenterX;
|
||||||
const oldRotationY = costume.rotationCenterY;
|
const oldRotationY = costume.rotationCenterY;
|
||||||
|
|
||||||
|
const AssetType = runtime.storage.AssetType;
|
||||||
|
const isVector = costume.dataFormat === AssetType.ImageVector.runtimeFormat;
|
||||||
|
|
||||||
// Use default asset if original fails to load
|
// 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.asset = runtime.storage.get(costume.assetId);
|
||||||
costume.md5 = `${costume.assetId}.${costume.dataFormat}`;
|
costume.md5 = `${costume.assetId}.${costume.dataFormat}`;
|
||||||
|
|
||||||
const AssetType = runtime.storage.AssetType;
|
const defaultCostumePromise = (isVector) ?
|
||||||
const defaultCostumePromise = (costume.dataFormat === AssetType.ImageVector.runtimeFormat) ?
|
|
||||||
loadVector_(costume, runtime) : loadBitmap_(costume, runtime);
|
loadVector_(costume, runtime) : loadBitmap_(costume, runtime);
|
||||||
|
|
||||||
return defaultCostumePromise.then(loadedCostume => {
|
return defaultCostumePromise.then(loadedCostume => {
|
||||||
|
|
Loading…
Reference in a new issue