Outlook_Addin_LLM/node_modules/@fluentui/utilities/lib/dom/getRect.js

29 lines
872 B
JavaScript

import { getWindow } from './getWindow';
/**
* Helper to get bounding client rect. Passing in window will get the window size.
*
* @public
*/
export function getRect(element, win) {
var theWin = (win !== null && win !== void 0 ? win : (!element || (element && element.hasOwnProperty('devicePixelRatio'))))
? getWindow()
: getWindow(element);
var rect;
if (element) {
if (element === theWin) {
rect = {
left: 0,
top: 0,
width: theWin.innerWidth,
height: theWin.innerHeight,
right: theWin.innerWidth,
bottom: theWin.innerHeight,
};
}
else if (element.getBoundingClientRect) {
rect = element.getBoundingClientRect();
}
}
return rect;
}
//# sourceMappingURL=getRect.js.map