Sha256: 613d2d75e4fe3fadcba8ba86853fc26ad0372a9c5d2881245bc32383e2adb10f
Contents?: true
Size: 1.07 KB
Versions: 18
Compression:
Stored size: 1.07 KB
Contents
const isMac = navigator.platform.toUpperCase().includes('MAC') // @ts-expect-error TS7006 const isVisible = (element) => !!(element.offsetWidth || element.offsetHeight || element.getClientRects().length > 0) // @ts-expect-error TS7006 const getOffset = (elment) => { const box = elment.getBoundingClientRect() return { top: box.top + (window.pageYOffset - document.documentElement.clientTop), left: box.left + (window.pageXOffset - document.documentElement.clientLeft), } } // @ts-expect-error TS7006 const computeBoundingBox = (element) => { if (!isVisible(element)) { return null } const boxFrame = getOffset(element) // @ts-expect-error TS2339 boxFrame.right = boxFrame.left + element.offsetWidth // @ts-expect-error TS2339 boxFrame.bottom = boxFrame.top + element.offsetHeight return { left: boxFrame.left, top: boxFrame.top, // @ts-expect-error TS2339 width: boxFrame.right - boxFrame.left, // @ts-expect-error TS2339 height: boxFrame.bottom - boxFrame.top, } } export { isMac, isVisible, getOffset, computeBoundingBox }
Version data entries
18 entries across 18 versions & 1 rubygems