From fab6fb0f5bf2c17401a892b50bdef7200b923bef Mon Sep 17 00:00:00 2001 From: Tamius Han Date: Thu, 26 Dec 2024 17:41:00 +0100 Subject: [PATCH] Fix mousemove position calculation --- src/ext/lib/uwui/UI.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/ext/lib/uwui/UI.js b/src/ext/lib/uwui/UI.js index c1a4e89..a036148 100644 --- a/src/ext/lib/uwui/UI.js +++ b/src/ext/lib/uwui/UI.js @@ -106,9 +106,17 @@ class UI { return; } + const rect = this.uiIframe.getBoundingClientRect(); + const offsets = { + top: window.scrollY + rect.top, + left: window.scrollX + rect.left + }; + + const coords = { - x: event.pageX - this.uiIframe.offsetLeft, - y: event.pageY - this.uiIframe.offsetTop + x: event.pageX - offsets.left, + y: event.pageY - offsets.top, + frameOffset: offsets, }; const playerData = this.canShowUI(coords);