| 70 | }; |
| 71 | |
| 72 | const measure = (element: HTMLElement): number[] => { |
| 73 | const rect = element.getBoundingClientRect(); |
| 74 | const parentRect = scrollParent?.getBoundingClientRect(); |
| 75 | return [ |
| 76 | rect.top - (parentRect?.top ?? 0), |
| 77 | rect.height, |
| 78 | parentRect?.top ?? 0, |
| 79 | scrollParent?.clientHeight ?? window.innerHeight, |
| 80 | scrollParent?.scrollHeight ?? document.documentElement.scrollHeight, |
| 81 | window.visualViewport?.offsetTop ?? 0, |
| 82 | window.visualViewport?.height ?? window.innerHeight, |
| 83 | ]; |
| 84 | }; |
| 85 | |
| 86 | const tick = () => { |
| 87 | if (performance.now() >= deadline) { |