]> cat aescling's git repositories - mastodon.git/commitdiff
Fix cover behaviour of thumbnails that are wider than taller (#6678)
authorEugen Rochko <eugen@zeonfederated.com>
Wed, 7 Mar 2018 11:02:05 +0000 (12:02 +0100)
committerGitHub <noreply@github.com>
Wed, 7 Mar 2018 11:02:05 +0000 (12:02 +0100)
app/javascript/mastodon/components/media_gallery.js

index 3568a844077a8c30f7723514372a77af7734d625..71436500af06499922ab6648aa837f6b22dc42c7 100644 (file)
@@ -167,6 +167,14 @@ class Item extends React.PureComponent {
           vShift = shiftToPoint(widthRatio, (containerHeight * (height / 100)), originalHeight, focusY, true);
         }
 
+        if (originalWidth > originalHeight) {
+          imageStyle.height = '100%';
+          imageStyle.width  = 'auto';
+        } else {
+          imageStyle.height = 'auto';
+          imageStyle.width  = '100%';
+        }
+
         imageStyle.top  = vShift;
         imageStyle.left = hShift;
       } else {