about summary refs log tree commit diff
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2018-03-07 12:02:05 +0100
committerGitHub <noreply@github.com>2018-03-07 12:02:05 +0100
commitb170627ceb8838c358aef1fcca9673ce4aa61ab8 (patch)
treec1a22f974513aaf459e5cb854527f1b71b4440b1
parenta1b065700a9aafd0989bd5686c849f961f727c83 (diff)
Fix cover behaviour of thumbnails that are wider than taller (#6678)
-rw-r--r--app/javascript/mastodon/components/media_gallery.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/javascript/mastodon/components/media_gallery.js b/app/javascript/mastodon/components/media_gallery.js
index 3568a8440..71436500a 100644
--- a/app/javascript/mastodon/components/media_gallery.js
+++ b/app/javascript/mastodon/components/media_gallery.js
@@ -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 {