From 72f2cbe9e86dff971dde96df120034bca1b25c00 Mon Sep 17 00:00:00 2001 From: Cory LaViska Date: Tue, 19 Oct 2021 09:43:16 -0400 Subject: [PATCH] fix aspect ratio bug --- docs/resources/changelog.md | 1 + src/components/responsive-media/responsive-media.ts | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/resources/changelog.md b/docs/resources/changelog.md index 27e32679..92069c41 100644 --- a/docs/resources/changelog.md +++ b/docs/resources/changelog.md @@ -13,6 +13,7 @@ _During the beta period, these restrictions may be relaxed in the event of a mis - Fixed a bug where the tooltip would show briefly when clicking a disabled `` - Fixed a bug that caused a console error when `` was used - Fixed a bug where the `nav` part in `` was on the incorrect element [#563](https://github.com/shoelace-style/shoelace/pull/563) +- Fixed a bug where non-integer aspect ratios were calculated incorrectly in `` - Updated to Bootstrap Icons to 1.6.1 ## 2.0.0-beta.57 diff --git a/src/components/responsive-media/responsive-media.ts b/src/components/responsive-media/responsive-media.ts index c4058f15..1463d062 100644 --- a/src/components/responsive-media/responsive-media.ts +++ b/src/components/responsive-media/responsive-media.ts @@ -24,8 +24,8 @@ export default class SlResponsiveMedia extends LitElement { render() { const split = this.aspectRatio.split(':'); - const x = parseInt(split[0]); - const y = parseInt(split[1]); + const x = parseFloat(split[0]); + const y = parseFloat(split[1]); const paddingBottom = x && y ? `${(y / x) * 100}%` : '0'; return html`