@vuesax-alpha/nightly
Version:
A Component Library for Vue 3
41 lines (36 loc) • 1.07 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var index = require('../../utils/index.js');
var dom = require('../../utils/dom.js');
require('../platform/get-document-element.js');
var getWindowScrollbarX = require('./get-window-scrollbar-x.js');
function getDocumentRect(element) {
const html = dom.getDocumentElement(element);
const scroll = dom.getNodeScroll(element);
const body = element.ownerDocument.body;
const width = index.max(
html.scrollWidth,
html.clientWidth,
body.scrollWidth,
body.clientWidth
);
const height = index.max(
html.scrollHeight,
html.clientHeight,
body.scrollHeight,
body.clientHeight
);
let x = -scroll.scrollLeft + getWindowScrollbarX.getWindowScrollBarX(element);
const y = -scroll.scrollTop;
if (dom.getComputedStyle(body).direction === "rtl") {
x += index.max(html.clientWidth, body.clientWidth) - width;
}
return {
width,
height,
x,
y
};
}
exports.getDocumentRect = getDocumentRect;
//# sourceMappingURL=get-document-rect.js.map