From 9f3d267e241bb2886f85d39e5e0e6dde45e6888b Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Mon, 28 Jun 2021 21:46:54 -0400 Subject: Fix incorrect aspect ratio of structured-content images (#1776) --- ext/js/display/structured-content-generator.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'ext/js') 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( -- cgit v1.2.3