diff --git a/assets/chat/js/menus/ChatMenuFloating.js b/assets/chat/js/menus/ChatMenuFloating.js index c0ad35ea..61116de0 100644 --- a/assets/chat/js/menus/ChatMenuFloating.js +++ b/assets/chat/js/menus/ChatMenuFloating.js @@ -55,16 +55,13 @@ export default class ChatMenuFloating extends ChatMenu { const rect = this.chat.output[0].getBoundingClientRect(); // calculating floating window location (if it doesn't fit on screen, adjusting it a bit so it does) const x = - this.ui.width() + e.clientX > rect.width - ? e.clientX - rect.left + (rect.width - (this.ui.width() + e.clientX)) - : e.clientX - rect.left; + this.ui.width() + e.clientX - rect.left > rect.width + ? e.clientX - this.ui.width() + (rect.right - e.clientX) + : e.clientX; const y = - this.ui.height() + e.clientY > rect.height - ? e.clientY - - rect.top + - (rect.height - (this.ui.height() + e.clientY)) - - 12 - : e.clientY - rect.top - 12; + this.ui.height() + e.clientY - rect.top > rect.height + ? e.clientY - this.ui.height() + (rect.bottom - e.clientY) - 12 + : e.clientY - 12; this.ui[0].style.left = `${x}px`; this.ui[0].style.top = `${y}px`;