Browse Source

Added check for slicer

master
Eduard Kuzmenko 4 years ago
parent
commit
1dfd9ec3f6
  1. 10
      src/lib/appManagers/appDialogsManager.ts

10
src/lib/appManagers/appDialogsManager.ts

@ -739,6 +739,8 @@ export class AppDialogsManager {
public onChatsRegularScroll = () => { public onChatsRegularScroll = () => {
if(this.sliceTimeout) clearTimeout(this.sliceTimeout); if(this.sliceTimeout) clearTimeout(this.sliceTimeout);
this.sliceTimeout = window.setTimeout(() => { this.sliceTimeout = window.setTimeout(() => {
this.sliceTimeout = undefined;
/* const observer = new IntersectionObserver((entries) => { /* const observer = new IntersectionObserver((entries) => {
const const
}); });
@ -747,13 +749,17 @@ export class AppDialogsManager {
observer.observe(el); observer.observe(el);
}); */ }); */
const scrollTopWas = this.scroll.scrollTop; //const scrollTopWas = this.scroll.scrollTop;
const rect = this.scroll.container.getBoundingClientRect(); const rect = this.scroll.container.getBoundingClientRect();
const children = Array.from(this.scroll.splitUp.children) as HTMLElement[]; const children = Array.from(this.scroll.splitUp.children) as HTMLElement[];
const firstElement = document.elementFromPoint(rect.x, rect.y) as HTMLElement; const firstElement = document.elementFromPoint(rect.x, rect.y) as HTMLElement;
const lastElement = document.elementFromPoint(rect.x, rect.y + rect.height - 1) as HTMLElement; const lastElement = document.elementFromPoint(rect.x, rect.y + rect.height - 1) as HTMLElement;
if(!firstElement || !lastElement) {
return;
}
const firstElementRect = firstElement.getBoundingClientRect(); const firstElementRect = firstElement.getBoundingClientRect();
const elementOverflow = firstElementRect.y - rect.y; const elementOverflow = firstElementRect.y - rect.y;
@ -804,8 +810,6 @@ export class AppDialogsManager {
const scrollTop = */ const scrollTop = */
//this.scroll.scrollIntoView(firstElement, false); //this.scroll.scrollIntoView(firstElement, false);
this.sliceTimeout = undefined;
}, 1e3); }, 1e3);
}; };

Loading…
Cancel
Save