Skip to content

Commit

Permalink
Fix: Edge case where a second row was displayed in horizontal scroll …
Browse files Browse the repository at this point in the history
…mode
  • Loading branch information
JurajNyiri committed Oct 2, 2021
1 parent 83acbc3 commit 664aa8d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
11 changes: 4 additions & 7 deletions dist/plex-meets-homeassistant.js
Original file line number Diff line number Diff line change
Expand Up @@ -19128,10 +19128,6 @@ const getHeight = (el) => {
const height = Math.max(el.scrollHeight, el.offsetHeight, el.clientHeight, el.scrollHeight, el.offsetHeight);
return height;
};
const getWidth = (el) => {
const width = Math.max(el.scrollWidth, el.offsetWidth, el.clientWidth, el.scrollWidth, el.offsetWidth);
return width;
};
const getOffset = (el) => {
let x = 0;
let y = 0;
Expand Down Expand Up @@ -21989,13 +21985,14 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if (count > this.renderedItems) {
this.contentContainer.appendChild(movieElem);
if (this.useHorizontalScroll) {
const marginRight = 10;
if (lodash.isEmpty(this.contentContainer.style.width)) {
this.contentContainer.style.width = `${getWidth(movieElem) + 10}px`;
this.contentContainer.style.width = `${parseFloat(movieElem.style.width) + marginRight}px`;
}
else {
this.contentContainer.style.width = `${parseFloat(this.contentContainer.style.width) +
getWidth(movieElem) +
10.15}px`;
parseFloat(movieElem.style.width) +
marginRight}px`;
}
}
this.renderedItems += 1;
Expand Down
7 changes: 4 additions & 3 deletions src/plex-meets-homeassistant.ts
Original file line number Diff line number Diff line change
Expand Up @@ -604,12 +604,13 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if (count > this.renderedItems) {
this.contentContainer.appendChild(movieElem);
if (this.useHorizontalScroll) {
const marginRight = 10;
if (_.isEmpty(this.contentContainer.style.width)) {
this.contentContainer.style.width = `${getWidth(movieElem) + 10}px`;
this.contentContainer.style.width = `${parseFloat(movieElem.style.width) + marginRight}px`;
} else {
this.contentContainer.style.width = `${parseFloat(this.contentContainer.style.width) +
getWidth(movieElem) +
10.15}px`;
parseFloat(movieElem.style.width) +
marginRight}px`;
}
}

Expand Down

0 comments on commit 664aa8d

Please sign in to comment.