Revert "Remove: calculatePositions no longer needed"

This reverts commit d67b705605.
pull/52/head
Juraj Nyíri 3 years ago
parent d67b705605
commit e3f3962311

@ -21907,6 +21907,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
(!this.maxRows || this.renderedRows < this.config.maxRows)) { (!this.maxRows || this.renderedRows < this.config.maxRows)) {
this.maxRenderCount = this.renderedItems + this.columnsCount * (loadAdditionalRowsCount * 2); this.maxRenderCount = this.renderedItems + this.columnsCount * (loadAdditionalRowsCount * 2);
this.renderMovieElems(); this.renderMovieElems();
this.calculatePositions();
} }
}; };
this.loadInitialData = async () => { this.loadInitialData = async () => {
@ -22610,8 +22611,31 @@ class PlexMeetsHomeAssistant extends HTMLElement {
endElem.className = 'clear'; endElem.className = 'clear';
this.contentContainer.appendChild(endElem); this.contentContainer.appendChild(endElem);
this.renderMovieElems(); this.renderMovieElems();
this.calculatePositions();
this.loadCustomStyles(); this.loadCustomStyles();
}; };
this.calculatePositions = () => {
// return; // temp
// todo: figure out why interval is needed here and do it properly
const setLeftOffsetsInterval = setInterval(() => {
this.movieElems = this.getElementsByClassName('movieElem');
for (let i = 0; i < this.movieElems.length; i += 1) {
if (this.movieElems[i].offsetLeft === 0) {
break;
}
else {
clearInterval(setLeftOffsetsInterval);
}
/*
this.movieElems[i].style.left = `${this.movieElems[i].offsetLeft}px`;
this.movieElems[i].dataset.left = this.movieElems[i].offsetLeft;
this.movieElems[i].style.top = `${this.movieElems[i].offsetTop}px`;
this.movieElems[i].dataset.top = this.movieElems[i].offsetTop;
this.movieElems[i].style.position = 'absolute';
*/
}
}, 100);
};
this.minimizeSeasons = () => { this.minimizeSeasons = () => {
this.seasonsElemHidden = false; this.seasonsElemHidden = false;
if (this.seasonsElem) { if (this.seasonsElem) {

@ -193,6 +193,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
) { ) {
this.maxRenderCount = this.renderedItems + this.columnsCount * (loadAdditionalRowsCount * 2); this.maxRenderCount = this.renderedItems + this.columnsCount * (loadAdditionalRowsCount * 2);
this.renderMovieElems(); this.renderMovieElems();
this.calculatePositions();
} }
}; };
@ -954,9 +955,32 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.contentContainer.appendChild(endElem); this.contentContainer.appendChild(endElem);
this.renderMovieElems(); this.renderMovieElems();
this.calculatePositions();
this.loadCustomStyles(); this.loadCustomStyles();
}; };
calculatePositions = (): void => {
// return; // temp
// todo: figure out why interval is needed here and do it properly
const setLeftOffsetsInterval = setInterval(() => {
this.movieElems = this.getElementsByClassName('movieElem');
for (let i = 0; i < this.movieElems.length; i += 1) {
if (this.movieElems[i].offsetLeft === 0) {
break;
} else {
clearInterval(setLeftOffsetsInterval);
}
/*
this.movieElems[i].style.left = `${this.movieElems[i].offsetLeft}px`;
this.movieElems[i].dataset.left = this.movieElems[i].offsetLeft;
this.movieElems[i].style.top = `${this.movieElems[i].offsetTop}px`;
this.movieElems[i].dataset.top = this.movieElems[i].offsetTop;
this.movieElems[i].style.position = 'absolute';
*/
}
}, 100);
};
minimizeSeasons = (): void => { minimizeSeasons = (): void => {
this.seasonsElemHidden = false; this.seasonsElemHidden = false;
if (this.seasonsElem) { if (this.seasonsElem) {

Loading…
Cancel
Save