@internal compute how many pixels the element is clipped: negative = above, positive = below, 0 = fully inside OR outside (stop scrolling)
(el: HTMLElement, scrollEl: HTMLElement)
| 441 | |
| 442 | /** @internal compute how many pixels the element is clipped: negative = above, positive = below, 0 = fully inside OR outside (stop scrolling) */ |
| 443 | protected _getClipping(el: HTMLElement, scrollEl: HTMLElement): number { |
| 444 | const elRect = el.getBoundingClientRect(); |
| 445 | const scrollRect = scrollEl.getBoundingClientRect(); |
| 446 | const viewportH = window.innerHeight || document.documentElement.clientHeight; |
| 447 | if (elRect.bottom < scrollRect.top || elRect.top > scrollRect.bottom) return 0; // fully outside |
| 448 | const clippedBelow = elRect.bottom - Math.min(scrollRect.bottom, viewportH); |
| 449 | const clippedAbove = elRect.top - Math.max(scrollRect.top, 0); |
| 450 | if (clippedAbove < 0) return clippedAbove; |
| 451 | if (clippedBelow > 0) return clippedBelow; |
| 452 | return 0; |
| 453 | } |
| 454 | |
| 455 | /** @internal single tick of the auto-scroll animation loop */ |
| 456 | protected _autoScrollTick = (): void => { |
no outgoing calls
no test coverage detected