source: imaps-frontend/node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js

main
Last change on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 2 weeks ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 1.2 KB
Line 
1import getDocumentElement from "./getDocumentElement.js";
2import getComputedStyle from "./getComputedStyle.js";
3import getWindowScrollBarX from "./getWindowScrollBarX.js";
4import getWindowScroll from "./getWindowScroll.js";
5import { max } from "../utils/math.js"; // Gets the entire size of the scrollable document area, even extending outside
6// of the `<html>` and `<body>` rect bounds if horizontally scrollable
7
8export default function getDocumentRect(element) {
9 var _element$ownerDocumen;
10
11 var html = getDocumentElement(element);
12 var winScroll = getWindowScroll(element);
13 var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
14 var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
15 var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
16 var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
17 var y = -winScroll.scrollTop;
18
19 if (getComputedStyle(body || html).direction === 'rtl') {
20 x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
21 }
22
23 return {
24 width: width,
25 height: height,
26 x: x,
27 y: y
28 };
29}
Note: See TracBrowser for help on using the repository browser.