Fix: Edge case bug where posters became randomly tiny

pull/30/head 2.0.5
Juraj Nyíri 4 years ago
parent e49f43faf7
commit 7be18026c9

@ -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);

@ -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);

Loading…
Cancel
Save