diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index 2c20cb4..bbc51b4 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -21086,8 +21086,10 @@ class PlexMeetsHomeAssistant extends HTMLElement { const marginRight = 10; // needs to be equal to .container margin right const areaSize = this.card.offsetWidth - parseInt(this.card.style.paddingRight, 10) - parseInt(this.card.style.paddingLeft, 10); const postersInRow = Math.floor(areaSize / CSS_STYLE.minimumWidth); - CSS_STYLE.width = areaSize / postersInRow - marginRight; - CSS_STYLE.height = CSS_STYLE.width * CSS_STYLE.ratio; + 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); diff --git a/src/plex-meets-homeassistant.ts b/src/plex-meets-homeassistant.ts index 5cb28b9..2c21370 100644 --- a/src/plex-meets-homeassistant.ts +++ b/src/plex-meets-homeassistant.ts @@ -494,8 +494,10 @@ class PlexMeetsHomeAssistant extends HTMLElement { const areaSize = this.card.offsetWidth - parseInt(this.card.style.paddingRight, 10) - parseInt(this.card.style.paddingLeft, 10); const postersInRow = Math.floor(areaSize / CSS_STYLE.minimumWidth); - CSS_STYLE.width = areaSize / postersInRow - marginRight; - CSS_STYLE.height = CSS_STYLE.width * CSS_STYLE.ratio; + 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);