UNPKG

@vuesax-alpha/nightly

Version:
37 lines (34 loc) 983 B
import { max } from '../../utils/index.mjs'; import { getDocumentElement, getNodeScroll, getComputedStyle } from '../../utils/dom.mjs'; import '../platform/get-document-element.mjs'; import { getWindowScrollBarX } from './get-window-scrollbar-x.mjs'; function getDocumentRect(element) { const html = getDocumentElement(element); const scroll = getNodeScroll(element); const body = element.ownerDocument.body; const width = max( html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth ); const height = max( html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight ); let x = -scroll.scrollLeft + getWindowScrollBarX(element); const y = -scroll.scrollTop; if (getComputedStyle(body).direction === "rtl") { x += max(html.clientWidth, body.clientWidth) - width; } return { width, height, x, y }; } export { getDocumentRect }; //# sourceMappingURL=get-document-rect.mjs.map