about summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-04-15 20:58:24 +0200
committerThibaut Girka <thib@sitedethib.com>2018-04-19 11:16:18 +0200
commit779aa707ecefd96fe72188ca836de02ad25c5fa5 (patch)
tree62e54700e429d05c60c15ac7712283e1cb8e18df /app
parent52229405ed9c2ff531c75b42fa220cb789dd0600 (diff)
Only compute height dynamically for standalone media
This prevents changing the status' height and triggering jumps in the TL
Diffstat (limited to 'app')
-rw-r--r--app/javascript/flavours/glitch/components/media_gallery.js10
1 files changed, 3 insertions, 7 deletions
diff --git a/app/javascript/flavours/glitch/components/media_gallery.js b/app/javascript/flavours/glitch/components/media_gallery.js
index 85949d49d..5169ead5a 100644
--- a/app/javascript/flavours/glitch/components/media_gallery.js
+++ b/app/javascript/flavours/glitch/components/media_gallery.js
@@ -238,7 +238,7 @@ export default class MediaGallery extends React.PureComponent {
   }
 
   handleRef = (node) => {
-    if (node /*&& this.isStandaloneEligible()*/) {
+    if (node && this.isStandaloneEligible()) {
       // offsetWidth triggers a layout, so only calculate when we need to
       this.setState({
         width: node.offsetWidth,
@@ -260,12 +260,8 @@ export default class MediaGallery extends React.PureComponent {
 
     const style = {};
 
-    if (this.isStandaloneEligible()) {
-      if (width) {
-        style.height = width / this.props.media.getIn([0, 'meta', 'small', 'aspect']);
-      }
-    } else if (width) {
-      style.height = width / (16/9);
+    if (this.isStandaloneEligible() && width) {
+      style.height = width / this.props.media.getIn([0, 'meta', 'small', 'aspect']);
     }
 
     if (!visible) {