UNPKG

@kubit-ui-web/react-components

Version:

Kubit React Components is a customizable, accessible library of React web components, designed to enhance your application's user experience

29 lines 932 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getViewportRect = void 0; const is_utils_1 = require("./is.utils"); const getViewportRect = (strategy) => { const html = window.document.documentElement; const visualViewport = window.visualViewport; let width = html.clientWidth; let height = html.clientHeight; let x = 0; let y = 0; if (visualViewport) { width = visualViewport.width; height = visualViewport.height; const visualViewportBased = (0, is_utils_1.isClientRectVisualViewportBased)(); if (!visualViewportBased || (visualViewportBased && strategy === 'fixed')) { x = visualViewport.offsetLeft; y = visualViewport.offsetTop; } } return { width, height, x, y, }; }; exports.getViewportRect = getViewportRect; //# sourceMappingURL=getViewportRect.js.map