import getOffsetRectRelativeToArbitraryNode from './getOffsetRectRelativeToArbitraryNode';
import getScroll from './getScroll';

export default function getViewportOffsetRectRelativeToArtbitraryNode(element) {
    const html = window.document.documentElement;
    const relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
    const width = Math.max(html.clientWidth, window.innerWidth || 0);
    const height = Math.max(html.clientHeight, window.innerHeight || 0);

    const scrollTop = getScroll(html);
    const scrollLeft = getScroll(html, 'left');

    console.log(relativeOffset, scrollTop, scrollLeft);

    return {
        top: scrollTop - relativeOffset.top ,
        bottom: scrollTop - relativeOffset.top + height,
        left: scrollLeft - relativeOffset.left,
        right: scrollLeft - relativeOffset.left + width,
    };
}

@@ -17,248 +17,353 @@
 Rect
-RelativeToArbitraryNode from './getOffsetRectRelativeToArbitraryNode';%0Aimport getScroll from './getScroll';%0A%0Aexport default function getViewportOffsetRectRelativeToArtbitraryNode(element) %7B%0A    const html = window.document.documentE
+ from './getOffsetRect';%0Aimport getOffsetParent from './getOffsetParent';%0A%0Aexport default function getViewportOffsetRectRelativeToArtbitraryNode(element) %7B%0A    // Offset relative to offsetParent%0A    const relativeOffset = getOffsetRect(element);%0A%0A    if (element.nodeName !== 'HTML') %7B%0A        const offsetParent = getOffsetParent(e
 lement
+)
 ;%0A
+    
     
@@ -364,32 +364,30 @@
       const 
-relative
+parent
 Offset = get
@@ -378,32 +378,40 @@
 rentOffset = get
+Viewport
 OffsetRectRelati
@@ -416,16 +416,17 @@
 tiveToAr
+t
 bitraryN
@@ -433,359 +433,247 @@
 ode(
-element, html
+offsetParent
 );%0A    
+    
 const 
-width = Math.max(html.clientWidth, window.innerWidth %7C%7C 0);%0A    const height = Math.max(html.clientHeight, window.innerHeight %7C%7C 0);%0A%0A    const scrollTop = getScroll(html);%0A    const scrollLeft = getScroll(html, 'left');%0A%0A    console.log(relativeOffset, scrollTop, scrollLeft);%0A%0A    return %7B%0A        top: scrollTop - relative
+offset = %7B%0A            width: relativeOffset.offsetWidth,%0A            height: relativeOffset.offsetHeight,%0A            left: relativeOffset.left + parentOffset.left,%0A            top: relativeOffset.top + parent
 Offs
@@ -678,17 +678,16 @@
 fset.top
- 
 ,%0A      
@@ -692,103 +692,125 @@
     
-bottom: scrollTop - relativeOffset.top + height,%0A        left: scrollLeft - relative
+    right: relativeOffset.right - parentOffset.right,%0A            bottom: relativeOffset.bottom - parent
 Offset.
-left
+bottom
 ,%0A  
@@ -819,62 +819,66 @@
     
-right: scrollLeft - relativeOffset.left + width,%0A    %7D
+%7D;%0A        return offset;%0A    %7D%0A%0A    return relativeOffset
 ;%0A%7D%0A

Revert silly change