| 9261 | | 9261 | |
| 9262 | const scrollIsAtBottom = Math.abs(chatElementScroll.scrollHeight - chatElementScroll.clientHeight - chatElementScroll.scrollTop) < 1; | 9262 | const scrollIsAtBottom = Math.abs(chatElementScroll.scrollHeight - chatElementScroll.clientHeight - chatElementScroll.scrollTop) < 1; |
| 9263 | | 9263 | |
| 9264 | // Cancel autoscroll if the user scrolls up | 9264 | // Resume autoscroll if the user scrolls to the bottom |
| 9265 | if (scrollLock && scrollIsAtBottom) { | 9265 | if (scrollLock && scrollIsAtBottom) { |
| 9266 | scrollLock = false; | 9266 | scrollLock = false; |
| 9267 | } | 9267 | } |
| 9268 | | 9268 | |
| 9269 | // Resume autoscroll if the user scrolls to the bottom | 9269 | // Cancel autoscroll if the user scrolls up |
| 9270 | if (!scrollLock && !scrollIsAtBottom) { | 9270 | if (!scrollLock && !scrollIsAtBottom) { |
| 9271 | scrollLock = true; | 9271 | scrollLock = true; |
| 9272 | } | 9272 | } |