mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-03-13 17:04:39 -04:00
Code clean up from code review
Co-authored-by: Christopher Willis-Ford <7019101+cwillisf@users.noreply.github.com>
This commit is contained in:
parent
172409c1e3
commit
fd31a777e2
3 changed files with 5 additions and 9 deletions
|
@ -16,13 +16,9 @@ const serializeAssets = function (runtime, assetType, optTargetId) {
|
|||
const currAssets = currTarget.sprite[assetType];
|
||||
for (let j = 0; j < currAssets.length; j++) {
|
||||
const currAsset = currAssets[j];
|
||||
let asset = currAsset.asset;
|
||||
if (currAsset.broken) {
|
||||
if (currAsset.broken.asset) {
|
||||
asset = currAsset.broken.asset;
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
const asset = currAsset.broken ? curAsset.broken.asset : currAsset.asset;
|
||||
if (!asset) {
|
||||
continue;
|
||||
}
|
||||
assetDescs.push({
|
||||
fileName: `${asset.assetId}.${asset.dataFormat}`,
|
||||
|
|
|
@ -931,7 +931,7 @@ class VirtualMachine extends EventEmitter {
|
|||
*/
|
||||
updateSvg (costumeIndex, svg, rotationCenterX, rotationCenterY) {
|
||||
const costume = this.editingTarget.getCostumes()[costumeIndex];
|
||||
if (costume && costume.broken) costume.broken = null;
|
||||
if (costume && costume.broken) delete costume.broken;
|
||||
if (costume && this.runtime && this.runtime.renderer) {
|
||||
costume.rotationCenterX = rotationCenterX;
|
||||
costume.rotationCenterY = rotationCenterY;
|
||||
|
|
2
test/fixtures/readProjectFile.js
vendored
2
test/fixtures/readProjectFile.js
vendored
|
@ -15,7 +15,7 @@ module.exports = {
|
|||
},
|
||||
extractAsset: function (path, assetFileName) {
|
||||
const zip = new AdmZip(path);
|
||||
const assetEntry = zip.getEntries().filter(item => item.entryName.match(assetFileName))[0];
|
||||
const assetEntry = zip.getEntries().find(item => item.entryName.match(assetFileName));
|
||||
return assetEntry.getData();
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue