apphouse
Version:
Component library for React that uses observable state management and theme-able components.
16 lines (15 loc) • 359 B
text/typescript
export interface Dim {
bottom: number;
height: number;
left: number;
right: number;
top: number;
width: number;
x: number;
y: number;
}
export const getDim = (element: any): Dim => {
const { bottom, height, left, right, top, width, x, y } =
element.getBoundingClientRect();
return { bottom, height, left, right, top, width, x, y };
};