UNPKG

@uifabric/utilities

Version:

Fluent UI React utilities for building components.

25 lines 646 B
/** * Helper to get bounding client rect. Passing in window will get the window size. * * @public */ export function getRect(element) { var rect; if (element) { if (element === window) { rect = { left: 0, top: 0, width: window.innerWidth, height: window.innerHeight, right: window.innerWidth, bottom: window.innerHeight, }; } else if (element.getBoundingClientRect) { rect = element.getBoundingClientRect(); } } return rect; } //# sourceMappingURL=getRect.js.map