You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i’m trying to collect mouse tracking data on our html but i noticed that there are a couple of indiscrepencies in the collected data for the nested elements:
Firstly, the positions are not correct if there is any scroll in any nested elements, so i modified the function getMousePos slightly to
function getMousePos(event) {
let docX = event.clientX || 0;
let docY = event.clientY || 0;
let element = event.target;
while (element) {
docX += element.scrollLeft || 0;
docY += element.scrollTop || 0;
element = element.parentElement;
}
return { x: docX, y: docY };
}
secondly, the scrolls in nested elements are not captured. I could fix this by changing the bubbling phase to capturing phase in the tracklib file. However, I don’t know why that works.
i was wondering if these two modification are fine and would not affect other things?
Best,
The text was updated successfully, but these errors were encountered:
Hello,
i’m trying to collect mouse tracking data on our html but i noticed that there are a couple of indiscrepencies in the collected data for the nested elements:
Firstly, the positions are not correct if there is any scroll in any nested elements, so i modified the function
getMousePos
slightly tosecondly, the scrolls in nested elements are not captured. I could fix this by changing the bubbling phase to capturing phase in the tracklib file. However, I don’t know why that works.
i was wondering if these two modification are fine and would not affect other things?
Best,
The text was updated successfully, but these errors were encountered: