We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 91dee93 commit 1761031Copy full SHA for 1761031
src/useMouse.ts
@@ -29,7 +29,7 @@ const useMouse = (ref: RefObject<HTMLElement>): State => {
29
cancelAnimationFrame(frame.current)
30
frame.current = requestAnimationFrame(() => {
31
if (ref && ref.current) {
32
- const {left, top} = ref.current.getBoundingClientRect()
+ const {left, top, width, height} = ref.current.getBoundingClientRect()
33
const posX = left + window.scrollX;
34
const posY = top + window.scrollY;
35
@@ -40,8 +40,8 @@ const useMouse = (ref: RefObject<HTMLElement>): State => {
40
posY,
41
elX: event.pageX - posX,
42
elY: event.pageY - posY,
43
- elH: ref.current.offsetHeight,
44
- elW: ref.current.offsetWidth,
+ elH: height,
+ elW: width,
45
});
46
}
47
0 commit comments