@progress/kendo-vue-popup
Version:
Kendo UI for Vue Popup package
36 lines (35 loc) • 1.4 kB
JavaScript
/**
* @license
*-------------------------------------------------------------------------------------------
* Copyright © 2025 Progress Software Corporation. All rights reserved.
* Licensed under commercial license. See LICENSE.md in the package root for more information
*-------------------------------------------------------------------------------------------
*/
import { eitherRect as f, removeStackingOffset as m } from "../util.mjs";
class w {
constructor(t) {
this._dom = t;
}
alignElement(t) {
const { anchor: e, element: o, anchorAlign: s, elementAlign: i, offset: n } = t, c = !this._dom.hasOffsetParent(o) ? this.absoluteRect(e, o, n) : this.relativeRect(e, o, n);
return this._dom.align({
anchorAlign: s,
anchorRect: c,
elementAlign: i,
elementRect: this._dom.offset(o)
});
}
absoluteRect(t, e, o) {
const s = this._dom, i = f(s.offset(t), o), n = s.stackingElementOffset(e), r = m(i, n), c = s.stackingElementScroll(e), a = s.addScroll(r, c), d = this.elementScrollPosition(t, e), l = s.removeScroll(a, d);
return l.left += window.scrollX || window.pageXOffset, l.top += window.scrollY || window.pageYOffset, l;
}
elementScrollPosition(t, e) {
return t ? { x: 0, y: 0 } : this._dom.scrollPosition(e);
}
relativeRect(t, e, o) {
return f(this._dom.position(t, e), o);
}
}
export {
w as AlignService
};