UNPKG

fabric

Version:

Object model for HTML5 canvas, and SVG-to-canvas parser. Backed by jsdom and node-canvas.

3 lines (2 loc) 623 B
function o(o){const l=o&&e(o);let t=0,n=0;if(!o||!l)return{left:t,top:n};let r=o;const c=l.documentElement,s=l.body||{scrollLeft:0,scrollTop:0};for(;r&&(r.parentNode||r.host)&&(r=r.parentNode||r.host,r===l?(t=s.scrollLeft||c.scrollLeft||0,n=s.scrollTop||c.scrollTop||0):(t+=r.scrollLeft||0,n+=r.scrollTop||0),1!==r.nodeType||"fixed"!==r.style.position););return{left:t,top:n}}const e=o=>o.ownerDocument||null,l=o=>{var e;return(null===(e=o.ownerDocument)||void 0===e?void 0:e.defaultView)||null};export{e as getDocumentFromElement,o as getScrollLeftTop,l as getWindowFromElement}; //# sourceMappingURL=dom_misc.min.mjs.map