Fix mousemove position calculation

This commit is contained in:
Tamius Han 2024-12-26 17:41:00 +01:00
parent 3b8fc807f7
commit fab6fb0f5b

View File

@ -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);