Improved the channel tree scroll fix handler and updated the ChangeLog.md

canary
WolverinDEV 2020-07-18 00:02:28 +02:00
parent 3155fb85f0
commit 52efd2fde5
2 changed files with 11 additions and 8 deletions

View File

@ -1,5 +1,5 @@
# Changelog:
* **XX.XX.20**
* **18.07.20**
- Rewrote the channel conversation UI and manager
- Several bug fixes like the scrollbar
- Updated the channel history view mode
@ -17,6 +17,7 @@
- Fixed chat scroll bar after switching tabs
- Fixed the chat "scroll to new messages" button
- Finalized the loader animation
- Improved the channel tree scroll fix handler
* **12.07.20**
- Made the loader compatible with ES5 to support older browsers

View File

@ -62,7 +62,7 @@ export class ChannelTreeView extends ReactComponentBase<ChannelTreeViewPropertie
private listener_tree_visibility_changed;
private update_timeout;
private fixScrollTimer;
private scrollFixRequested;
private mouse_move: { x: number, y: number, down: boolean, fired: boolean } = { x: 0, y: 0, down: false, fired: false };
private document_mouse_listener;
@ -135,18 +135,20 @@ export class ChannelTreeView extends ReactComponentBase<ChannelTreeViewPropertie
};
this.listener_tree_visibility_changed = (event: ConnectionEvents["notify_visibility_changed"]) => {
clearTimeout(this.fixScrollTimer);
if(!event.visible) {
this.setState({ smoothScroll: false });
return;
}
this.fixScrollTimer = setTimeout(() => {
if(this.scrollFixRequested)
return;
this.scrollFixRequested = true;
requestAnimationFrame(() => {
this.scrollFixRequested = false;
this.ref_container.current.scrollTop = this.state.scroll_offset;
this.fixScrollTimer = setTimeout(() => {
this.setState({ smoothScroll: true });
}, 50);
}, 50);
this.setState({ smoothScroll: true });
});
}
}