1 | "use strict";
|
2 |
|
3 | const {getIntersectionRatio} = require("./intersectionCalc");
|
4 |
|
5 | module.exports = function FakeIntersectionObserverEntry(browser) {
|
6 | return IntersectionObserverEntry;
|
7 |
|
8 | function IntersectionObserverEntry(element, rootMargin) {
|
9 | const boundingClientRect = element.getBoundingClientRect();
|
10 | const intersectionRatio = getIntersectionRatio(boundingClientRect, browser.window.innerHeight, rootMargin);
|
11 |
|
12 | return {target: element, boundingClientRect, intersectionRatio};
|
13 | }
|
14 | };
|