UNPKG

@aplus-frontend/ui

Version:

2 lines (1 loc) 412 B
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function g(o,c,t){const e=o.getBoundingClientRect(),n=c.getBoundingClientRect(),s=t==="x"?"left":"top",f=t==="x"?"right":"bottom",l=t==="x"?"width":"height";return{start:n[s]-e[s],end:n[f]-e[f],center:n[f]-e[f]+(e[l]-n[l])/2}}function r(o,c,t){const e=g(o,c,"x"),n=g(o,c,"y");return{x:e[t],y:n[t]}}exports.getElementScrollOffset=r;