|
|
@@ -49,6 +49,7 @@
|
|
|
let loadDeferredImages;
|
|
|
|
|
|
addEventListener(LOAD_DEFERRED_IMAGES_START_EVENT, () => {
|
|
|
+ loadDeferredImages = true;
|
|
|
const scrollingElement = document.scrollingElement || document.documentElement;
|
|
|
const clientHeight = scrollingElement.clientHeight;
|
|
|
const clientWidth = scrollingElement.clientWidth;
|
|
|
@@ -121,6 +122,24 @@
|
|
|
}
|
|
|
dispatchEvent(new UIEvent("resize"));
|
|
|
dispatchEvent(new UIEvent("scroll"));
|
|
|
+ const docBoundingRect = scrollingElement.getBoundingClientRect();
|
|
|
+ Array.from(observers, ([intersectionObserver, observer]) => {
|
|
|
+ const rootBoundingRect = observer.options.root && observer.options.root.getBoundingClientRect();
|
|
|
+ observer.callback(observedElements.get(intersectionObserver).map(target => {
|
|
|
+ const boundingClientRect = target.getBoundingClientRect();
|
|
|
+ const isIntersecting = true;
|
|
|
+ const intersectionRatio = 1;
|
|
|
+ const rootBounds = observer.options && observer.options.root ? rootBoundingRect : docBoundingRect;
|
|
|
+ const time = 0;
|
|
|
+ return { target, intersectionRatio, boundingClientRect, intersectionRect: boundingClientRect, isIntersecting, rootBounds, time };
|
|
|
+ }), intersectionObserver);
|
|
|
+ });
|
|
|
+ if (pendingRequestAnimationFrameCalls.size) {
|
|
|
+ Array.from(pendingRequestAnimationFrameCalls).forEach(([id, callback]) => {
|
|
|
+ cancelAnimationFrame(id);
|
|
|
+ callback();
|
|
|
+ });
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
|
|
|
@@ -143,6 +162,7 @@
|
|
|
window.Image = window._singleFileImage;
|
|
|
delete window._singleFileImage;
|
|
|
}
|
|
|
+ loadDeferredImages = false;
|
|
|
dispatchEvent(new UIEvent("resize"));
|
|
|
dispatchEvent(new UIEvent("scroll"));
|
|
|
});
|
|
|
@@ -177,33 +197,6 @@
|
|
|
}
|
|
|
});
|
|
|
|
|
|
- addEventListener(LOAD_DEFERRED_IMAGES_START_EVENT, () => {
|
|
|
- loadDeferredImages = true;
|
|
|
- const scrollingElement = document.scrollingElement || document.documentElement;
|
|
|
- const docBoundingRect = scrollingElement.getBoundingClientRect();
|
|
|
- Array.from(observers, ([intersectionObserver, observer]) => {
|
|
|
- const rootBoundingRect = observer.options.root && observer.options.root.getBoundingClientRect();
|
|
|
- observer.callback(observedElements.get(intersectionObserver).map(target => {
|
|
|
- const boundingClientRect = target.getBoundingClientRect();
|
|
|
- const isIntersecting = true;
|
|
|
- const intersectionRatio = 1;
|
|
|
- const rootBounds = observer.options && observer.options.root ? rootBoundingRect : docBoundingRect;
|
|
|
- const time = 0;
|
|
|
- return { target, intersectionRatio, boundingClientRect, intersectionRect: boundingClientRect, isIntersecting, rootBounds, time };
|
|
|
- }), intersectionObserver);
|
|
|
- });
|
|
|
- if (pendingRequestAnimationFrameCalls.size) {
|
|
|
- Array.from(pendingRequestAnimationFrameCalls).forEach(([id, callback]) => {
|
|
|
- cancelAnimationFrame(id);
|
|
|
- callback();
|
|
|
- });
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- addEventListener(LOAD_DEFERRED_IMAGES_END_EVENT, () => {
|
|
|
- loadDeferredImages = false;
|
|
|
- });
|
|
|
-
|
|
|
let warningRequestAnimationFrameDisplayed;
|
|
|
const pendingRequestAnimationFrameCalls = new Map();
|
|
|
let lastTimestamp = 0;
|