MCPcopy Create free account
hub / github.com/DavidHDev/react-bits / getLocalPointerPos

Function getLocalPointerPos

src/content/Animations/ImageTrail/ImageTrail.jsx:10–24  ·  view source on GitHub ↗
(e, rect)

Source from the content-addressed store, hash-verified

8}
9
10function getLocalPointerPos(e, rect) {
11 let clientX = 0,
12 clientY = 0;
13 if (e.touches && e.touches.length > 0) {
14 clientX = e.touches[0].clientX;
15 clientY = e.touches[0].clientY;
16 } else {
17 clientX = e.clientX;
18 clientY = e.clientY;
19 }
20 return {
21 x: clientX - rect.left,
22 y: clientY - rect.top
23 };
24}
25function getMouseDistance(p1, p2) {
26 const dx = p1.x - p2.x;
27 const dy = p1.y - p2.y;

Callers 15

handlePointerMoveMethod · 0.70
initRenderMethod · 0.70
handlePointerMoveMethod · 0.70
initRenderMethod · 0.70
handlePointerMoveMethod · 0.70
initRenderMethod · 0.70
handlePointerMoveMethod · 0.70
initRenderMethod · 0.70
handlePointerMoveMethod · 0.70
initRenderMethod · 0.70
handlePointerMoveMethod · 0.70
initRenderMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected