Files
documenso/packages/lib/client-only/get-bounding-client-rect.ts
2023-08-23 11:22:13 +10:00

11 lines
276 B
TypeScript

export const getBoundingClientRect = (element: HTMLElement) => {
const rect = element.getBoundingClientRect();
const { width, height } = rect;
const top = rect.top + window.scrollY;
const left = rect.left + window.scrollX;
return { top, left, width, height };
};