Files
starface-outlook-sync-addin/node_modules/@fluentui/utilities/lib-amd/dom/getRect.js
T
Stefan Hacker 37ad745546 first commit
2026-04-03 09:38:48 +02:00

33 lines
1.1 KiB
JavaScript

define(["require", "exports", "./getWindow"], function (require, exports, getWindow_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.getRect = getRect;
/**
* Helper to get bounding client rect. Passing in window will get the window size.
*
* @public
*/
function getRect(element, win) {
var theWin = (win !== null && win !== void 0 ? win : (!element || (element && element.hasOwnProperty('devicePixelRatio'))))
? (0, getWindow_1.getWindow)()
: (0, getWindow_1.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