From 77a563fe182f36d91bf0c82e1116aea881f03278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Nyi=CC=81ri?= Date: Tue, 13 Jul 2021 00:28:33 +0200 Subject: [PATCH] Fix: Edge case bug where episodes preview became randomly tiny --- dist/plex-meets-homeassistant.js | 6 +++--- src/plex-meets-homeassistant.ts | 9 ++++----- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index bbc51b4..94b5f52 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -21089,10 +21089,10 @@ class PlexMeetsHomeAssistant extends HTMLElement { if (areaSize > 0) { CSS_STYLE.width = areaSize / postersInRow - marginRight; CSS_STYLE.height = CSS_STYLE.width * CSS_STYLE.ratio; + const episodesInRow = Math.floor(areaSize / CSS_STYLE.minimumEpisodeWidth); + CSS_STYLE.episodeWidth = Math.floor(areaSize / episodesInRow - marginRight); + CSS_STYLE.episodeHeight = Math.round(CSS_STYLE.episodeWidth * CSS_STYLE.episodeRatio); } - const episodesInRow = Math.floor(areaSize / CSS_STYLE.minimumEpisodeWidth); - CSS_STYLE.episodeWidth = Math.floor(areaSize / episodesInRow - marginRight); - CSS_STYLE.episodeHeight = Math.round(CSS_STYLE.episodeWidth * CSS_STYLE.episodeRatio); } this.renderedItems = 0; this.columnsCount = 0; diff --git a/src/plex-meets-homeassistant.ts b/src/plex-meets-homeassistant.ts index 2c21370..135aa01 100644 --- a/src/plex-meets-homeassistant.ts +++ b/src/plex-meets-homeassistant.ts @@ -497,12 +497,11 @@ class PlexMeetsHomeAssistant extends HTMLElement { if (areaSize > 0) { CSS_STYLE.width = areaSize / postersInRow - marginRight; CSS_STYLE.height = CSS_STYLE.width * CSS_STYLE.ratio; - } - - const episodesInRow = Math.floor(areaSize / CSS_STYLE.minimumEpisodeWidth); + const episodesInRow = Math.floor(areaSize / CSS_STYLE.minimumEpisodeWidth); - CSS_STYLE.episodeWidth = Math.floor(areaSize / episodesInRow - marginRight); - CSS_STYLE.episodeHeight = Math.round(CSS_STYLE.episodeWidth * CSS_STYLE.episodeRatio); + CSS_STYLE.episodeWidth = Math.floor(areaSize / episodesInRow - marginRight); + CSS_STYLE.episodeHeight = Math.round(CSS_STYLE.episodeWidth * CSS_STYLE.episodeRatio); + } } this.renderedItems = 0;