aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-06-28 21:46:54 -0400
committerGitHub <noreply@github.com>2021-06-28 21:46:54 -0400
commit9f3d267e241bb2886f85d39e5e0e6dde45e6888b (patch)
tree701dc3c3a1c55b474e6e3e3f4ffe4a3381850335
parentaf706dea7e25ae42a7e032a2275d69d3211a98e3 (diff)
Fix incorrect aspect ratio of structured-content images (#1776)
-rw-r--r--ext/js/display/structured-content-generator.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/js/display/structured-content-generator.js b/ext/js/display/structured-content-generator.js
index 5b10811f..98706ca9 100644
--- a/ext/js/display/structured-content-generator.js
+++ b/ext/js/display/structured-content-generator.js
@@ -83,15 +83,15 @@ class StructuredContentGenerator {
const hasPreferredWidth = (typeof preferredWidth === 'number');
const hasPreferredHeight = (typeof preferredHeight === 'number');
- const aspectRatio = (
+ const invAspectRatio = (
hasPreferredWidth && hasPreferredHeight ?
- preferredWidth / preferredHeight :
- width / height
+ preferredHeight / preferredWidth :
+ height / width
);
const usedWidth = (
hasPreferredWidth ?
preferredWidth :
- (hasPreferredHeight ? preferredHeight * aspectRatio : width)
+ (hasPreferredHeight ? preferredHeight * invAspectRatio : width)
);
const node = this._createElement('a', 'gloss-image-link');
@@ -139,7 +139,7 @@ class StructuredContentGenerator {
imageContainer.title = title;
}
- aspectRatioSizer.style.paddingTop = `${aspectRatio * 100.0}%`;
+ aspectRatioSizer.style.paddingTop = `${invAspectRatio * 100.0}%`;
if (this._mediaLoader !== null) {
this._mediaLoader.loadMedia(