mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2025-06-05 01:54:52 -04:00
More code cleanup from PR review
This commit is contained in:
parent
fd31a777e2
commit
1dfaa02c97
2 changed files with 15 additions and 8 deletions
|
@ -345,20 +345,27 @@ const serializeBlocks = function (blocks) {
|
|||
*/
|
||||
const serializeCostume = function (costume) {
|
||||
const obj = Object.create(null);
|
||||
obj.assetId = (costume.broken && costume.broken.assetId) || costume.assetId;
|
||||
obj.name = costume.name;
|
||||
obj.bitmapResolution = costume.bitmapResolution;
|
||||
obj.dataFormat = costume.dataFormat.toLowerCase();
|
||||
if (costume.broken) {
|
||||
obj.assetId = costume.broken.assetId;
|
||||
|
||||
// serialize this property with the name 'md5ext' because that's
|
||||
// what it's actually referring to. TODO runtime objects need to be
|
||||
// updated to actually refer to this as 'md5ext' instead of 'md5'
|
||||
// but that change should be made carefully since it is very
|
||||
// pervasive
|
||||
obj.md5ext = (costume.broken && costume.broken.md5) || costume.md5;
|
||||
obj.dataFormat = costume.dataFormat.toLowerCase();
|
||||
if (costume.broken) {
|
||||
obj.md5ext = (costume.broken.md5);
|
||||
|
||||
obj.rotationCenterX = costume.broken.rotationCenterX;
|
||||
obj.rotationCenterY = costume.broken.rotationCenterY;
|
||||
} else {
|
||||
obj.assetId = costume.assetId;
|
||||
|
||||
// See related comment above
|
||||
obj.md5ext = costume.md5;
|
||||
|
||||
obj.rotationCenterX = costume.rotationCenterX;
|
||||
obj.rotationCenterY = costume.rotationCenterY;
|
||||
}
|
||||
|
|
2
test/fixtures/readProjectFile.js
vendored
2
test/fixtures/readProjectFile.js
vendored
|
@ -7,7 +7,7 @@ module.exports = {
|
|||
},
|
||||
extractProjectJson: function (path) {
|
||||
const zip = new AdmZip(path);
|
||||
const projectEntry = zip.getEntries().filter(item => item.entryName.match(/project\.json/))[0];
|
||||
const projectEntry = zip.getEntries().find(item => item.entryName.match(/project\.json/))[0];
|
||||
if (projectEntry) {
|
||||
return JSON.parse(zip.readAsText(projectEntry.entryName, 'utf8'));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue