Fix mouse tracking bug when dom element is scrolled to a different position.
When using getBoundingClientRect, the returned coordinates are relative to the viewport. If the page is then scrolled and we have a dom element that is not the document, the top and left offsets are out of date, thus the rotation calculations are off (sometimes by a lot). In this fix, we instead do all calculations relative to the document (not the viewport) by adjusting the screen.left and screen.top variables with the scroll offset and using pageX/pageY instead of clientX/clientY for the click coordinates.
Showing
想要评论请 注册 或 登录