Browse Source

Only compute height dynamically for standalone media

This prevents changing the status' height and triggering jumps in the TL
closed-social-glitch-2
Thibaut Girka 6 years ago
parent
commit
779aa707ec
1 changed files with 3 additions and 7 deletions
  1. +3
    -7
      app/javascript/flavours/glitch/components/media_gallery.js

+ 3
- 7
app/javascript/flavours/glitch/components/media_gallery.js View File

@ -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) {

Loading…
Cancel
Save