Fix: Scroll event not working on touch devices

main 3.6.7
Juraj Nyiri 2 years ago
parent 452a9ac993
commit bc373d01b2

@ -22020,7 +22020,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
if (this.hassObj) { if (this.hassObj) {
this.entityRegistry = await fetchEntityRegistry(this.hassObj.connection); this.entityRegistry = await fetchEntityRegistry(this.hassObj.connection);
} }
window.addEventListener('wheel', () => { const scrollListener = () => {
// todo: improve performance by calculating this when needed only // todo: improve performance by calculating this when needed only
if (this.detailsShown && this.activeMovieElem && !isVideoFullScreen(this) && this.isVisible) { if (this.detailsShown && this.activeMovieElem && !isVideoFullScreen(this) && this.isVisible) {
const seasonContainers = this.getElementsByClassName('seasonContainer'); const seasonContainers = this.getElementsByClassName('seasonContainer');
@ -22060,7 +22060,11 @@ class PlexMeetsHomeAssistant extends HTMLElement {
} }
} }
this.renderNewElementsIfNeeded(); this.renderNewElementsIfNeeded();
}); };
this.haWindow.addEventListener('scroll', scrollListener);
// window.addEventListener('scroll', scrollListener);
// window.addEventListener('wheel', scrollListener);
// window.addEventListener('touchmove', scrollListener);
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.resizeHandler(); this.resizeHandler();
}); });

@ -255,7 +255,7 @@ class PlexMeetsHomeAssistant extends HTMLElement {
this.entityRegistry = await fetchEntityRegistry(this.hassObj.connection); this.entityRegistry = await fetchEntityRegistry(this.hassObj.connection);
} }
window.addEventListener('wheel', () => { const scrollListener = () => {
// todo: improve performance by calculating this when needed only // todo: improve performance by calculating this when needed only
if (this.detailsShown && this.activeMovieElem && !isVideoFullScreen(this) && this.isVisible) { if (this.detailsShown && this.activeMovieElem && !isVideoFullScreen(this) && this.isVisible) {
const seasonContainers = this.getElementsByClassName('seasonContainer') as HTMLCollectionOf<HTMLElement>; const seasonContainers = this.getElementsByClassName('seasonContainer') as HTMLCollectionOf<HTMLElement>;
@ -294,7 +294,13 @@ class PlexMeetsHomeAssistant extends HTMLElement {
} }
} }
this.renderNewElementsIfNeeded(); this.renderNewElementsIfNeeded();
}); };
this.haWindow.addEventListener('scroll', scrollListener);
// window.addEventListener('scroll', scrollListener);
// window.addEventListener('wheel', scrollListener);
// window.addEventListener('touchmove', scrollListener);
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
this.resizeHandler(); this.resizeHandler();
}); });

Loading…
Cancel
Save