From 9a3ac237dd5a118990a0398ae294e83c89f93aea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juraj=20Nyi=CC=81ri?= Date: Fri, 1 Oct 2021 13:08:15 +0200 Subject: [PATCH] Fix: reenable calculate positions --- dist/plex-meets-homeassistant.js | 17 ++++++++++++++++- src/plex-meets-homeassistant.ts | 1 - 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/dist/plex-meets-homeassistant.js b/dist/plex-meets-homeassistant.js index 85b8c05..d18cde6 100644 --- a/dist/plex-meets-homeassistant.js +++ b/dist/plex-meets-homeassistant.js @@ -22099,7 +22099,22 @@ class PlexMeetsHomeAssistant extends HTMLElement { 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; + } + }, 100); }; this.minimizeSeasons = () => { this.seasonsElemHidden = false; diff --git a/src/plex-meets-homeassistant.ts b/src/plex-meets-homeassistant.ts index b7133a3..39d2339 100644 --- a/src/plex-meets-homeassistant.ts +++ b/src/plex-meets-homeassistant.ts @@ -890,7 +890,6 @@ class PlexMeetsHomeAssistant extends HTMLElement { }; calculatePositions = (): void => { - return; // temp // todo: figure out why interval is needed here and do it properly const setLeftOffsetsInterval = setInterval(() => { this.movieElems = this.getElementsByClassName('movieElem');