fix support IE in useMouse

This commit is contained in:
Vadim Dalecky 2019-08-17 17:56:56 +02:00 committed by GitHub
commit 6df6a0ec36
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -37,8 +37,8 @@ const useMouse = (ref: RefObject<Element>): State => {
frame.current = requestAnimationFrame(() => {
if (ref && ref.current) {
const { left, top, width: elW, height: elH } = ref.current.getBoundingClientRect();
const posX = left + window.scrollX;
const posY = top + window.scrollY;
const posX = left + window.pageXOffset;
const posY = top + window.pageYOffset;
const elX = event.pageX - posX;
const elY = event.pageY - posY;