Fix: Edge case where a second row was displayed in horizontal scroll mode

music 3.0.7
Juraj Nyíri 3 years ago
parent 83acbc374a
commit 664aa8de3a

@ -19128,10 +19128,6 @@ const getHeight = (el) => {
const height = Math.max(el.scrollHeight, el.offsetHeight, el.clientHeight, el.scrollHeight, el.offsetHeight); const height = Math.max(el.scrollHeight, el.offsetHeight, el.clientHeight, el.scrollHeight, el.offsetHeight);
return height; return height;
}; };
const getWidth = (el) => {
const width = Math.max(el.scrollWidth, el.offsetWidth, el.clientWidth, el.scrollWidth, el.offsetWidth);
return width;
};
const getOffset = (el) => { const getOffset = (el) => {
let x = 0; let x = 0;
let y = 0; let y = 0;
@ -21989,13 +21985,14 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if (count > this.renderedItems) { if (count > this.renderedItems) {
this.contentContainer.appendChild(movieElem); this.contentContainer.appendChild(movieElem);
if (this.useHorizontalScroll) { if (this.useHorizontalScroll) {
const marginRight = 10;
if (lodash.isEmpty(this.contentContainer.style.width)) { 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 { else {
this.contentContainer.style.width = `${parseFloat(this.contentContainer.style.width) + this.contentContainer.style.width = `${parseFloat(this.contentContainer.style.width) +
getWidth(movieElem) + parseFloat(movieElem.style.width) +
10.15}px`; marginRight}px`;
} }
} }
this.renderedItems += 1; this.renderedItems += 1;

@ -604,12 +604,13 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if (count > this.renderedItems) { if (count > this.renderedItems) {
this.contentContainer.appendChild(movieElem); this.contentContainer.appendChild(movieElem);
if (this.useHorizontalScroll) { if (this.useHorizontalScroll) {
const marginRight = 10;
if (_.isEmpty(this.contentContainer.style.width)) { 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 { } else {
this.contentContainer.style.width = `${parseFloat(this.contentContainer.style.width) + this.contentContainer.style.width = `${parseFloat(this.contentContainer.style.width) +
getWidth(movieElem) + parseFloat(movieElem.style.width) +
10.15}px`; marginRight}px`;
} }
} }

Loading…
Cancel
Save