From 85689201ed26807f1c99917ef081bffee7dfc4c3 Mon Sep 17 00:00:00 2001 From: DD Liu Date: Wed, 23 May 2018 14:06:23 -0400 Subject: [PATCH 1/2] Always give backdrops a certain rotation center --- src/serialization/sb2.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/serialization/sb2.js b/src/serialization/sb2.js index 95d6d2ff..a50315bd 100644 --- a/src/serialization/sb2.js +++ b/src/serialization/sb2.js @@ -340,8 +340,8 @@ const parseScratchObject = function (object, runtime, extensions, topLevel, zip) const costume = { name: costumeSource.costumeName, bitmapResolution: costumeSource.bitmapResolution || 1, - rotationCenterX: costumeSource.rotationCenterX, - rotationCenterY: costumeSource.rotationCenterY, + rotationCenterX: topLevel ? 240 : costumeSource.rotationCenterX, + rotationCenterY: topLevel ? 180 : costumeSource.rotationCenterY, // TODO we eventually want this next property to be called // md5ext to reflect what it actually contains, however this // will be a very extensive change across many repositories From 10aa6979ed52b642bbb80dab9d2b12bfb2c2b0f3 Mon Sep 17 00:00:00 2001 From: DD Liu Date: Wed, 23 May 2018 14:18:22 -0400 Subject: [PATCH 2/2] Multiply by bitmap resolution --- src/serialization/sb2.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/serialization/sb2.js b/src/serialization/sb2.js index a50315bd..248c6115 100644 --- a/src/serialization/sb2.js +++ b/src/serialization/sb2.js @@ -337,11 +337,12 @@ const parseScratchObject = function (object, runtime, extensions, topLevel, zip) if (object.hasOwnProperty('costumes')) { for (let i = 0; i < object.costumes.length; i++) { const costumeSource = object.costumes[i]; + const bitmapResolution = costumeSource.bitmapResolution || 1; const costume = { name: costumeSource.costumeName, - bitmapResolution: costumeSource.bitmapResolution || 1, - rotationCenterX: topLevel ? 240 : costumeSource.rotationCenterX, - rotationCenterY: topLevel ? 180 : costumeSource.rotationCenterY, + bitmapResolution: bitmapResolution, + rotationCenterX: topLevel ? 240 * bitmapResolution : costumeSource.rotationCenterX, + rotationCenterY: topLevel ? 180 * bitmapResolution : costumeSource.rotationCenterY, // TODO we eventually want this next property to be called // md5ext to reflect what it actually contains, however this // will be a very extensive change across many repositories