function getPointerPosition(el, event) {
  const position = {};
  const box = findElPosition(el);
  const boxW = el.offsetWidth;
  const boxH = el.offsetHeight;

  const boxY = box.top;
  const boxX = box.left;
  let evtPageY = event.pageY;
  let evtPageX = event.pageX;

  if (event.changedTouches) {
    evtPageX = event.changedTouches[0].pageX;
    evtPageY = event.changedTouches[0].pageY;
  }

  position.y = Math.max(0, Math.min(1, (boxY - evtPageY + boxH) / boxH));
  position.x = Math.max(0, Math.min(1, (evtPageX - boxX) / boxW));

  return position;
}
Get pointer position in a React Node ref
Returns an object with x and y coordinates.
The base on the coordinates are the bottom left of the element.

@function getPointerPosition
@param {ReactNodeRef} el React Node ref on which to get the pointer position on
@param {Event} event Event object
@return {Object} This object will have x and y coordinates corresponding to the mouse position