From 9d3c95812ea467b526fd89e59593b668f134458e Mon Sep 17 00:00:00 2001
From: DD Liu <liudi@media.mit.edu>
Date: Tue, 1 May 2018 17:40:35 -0400
Subject: [PATCH] Fix displayed costume size

---
 src/containers/costume-tab.jsx | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/containers/costume-tab.jsx b/src/containers/costume-tab.jsx
index 641d77380..1b8b2b993 100644
--- a/src/containers/costume-tab.jsx
+++ b/src/containers/costume-tab.jsx
@@ -194,10 +194,12 @@ class CostumeTab extends React.Component {
     setFileInput (input) {
         this.fileInput = input;
     }
-    formatCostumeDetails (size) {
+    formatCostumeDetails (size, optResolution) {
+        const resolution = optResolution ? optResolution : 1;
+        // Convert size to stage units by dividing by resolution
         // Round up width and height for scratch-flash compatibility
         // https://github.com/LLK/scratch-flash/blob/9fbac92ef3d09ceca0c0782f8a08deaa79e4df69/src/ui/media/MediaInfo.as#L224-L237
-        return `${Math.ceil(size[0])} x ${Math.ceil(size[1])}`;
+        return `${Math.ceil(size[0] / resolution)} x ${Math.ceil(size[1] / resolution)}`;
     }
     render () {
         const {
@@ -232,7 +234,7 @@ class CostumeTab extends React.Component {
         const costumeData = (target.costumes || []).map(costume => ({
             name: costume.name,
             assetId: costume.assetId,
-            details: costume.size ? this.formatCostumeDetails(costume.size) : null
+            details: costume.size ? this.formatCostumeDetails(costume.size, costume.bitmapResolution) : null
         }));
 
         return (
-- 
GitLab