import { NumberArray , Location } from '../types' ; internal export const getOffset = ( element ) : NumberArray => { const { left , top } = element . getBoundingClientRect ( ) ; const { defaultView } = element . ownerDocument ! ; const { pageXOffset , pageYOffset } = defaultView ! ; return [ left + pageXOffset , top + pageYOffset ] ; } ; internal export const getEventCoords = ( e , offset ) : Location => { const { pageX , pageY } = e . touches ? e . touches [ 0 ] : e ; return [ pageX - offset [ 0 ] , pageY - offset [ 1 ] ] ; } ;