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 | |
---|
1 | import getDocumentElement from "./getDocumentElement.js";
|
---|
2 | import getComputedStyle from "./getComputedStyle.js";
|
---|
3 | import getWindowScrollBarX from "./getWindowScrollBarX.js";
|
---|
4 | import getWindowScroll from "./getWindowScroll.js";
|
---|
5 | import { 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 |
|
---|
8 | export 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.