/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ /** * Gets whether an element is scrolled outside of view by any of its parent scrolling containers. * @param element Dimensions of the element (from getBoundingClientRect) * @param scrollContainers Dimensions of element's scrolling containers (from getBoundingClientRect) * @returns Whether the element is scrolled out of view * @docs-private */ export function isElementScrolledOutsideView(element, scrollContainers) { return scrollContainers.some(containerBounds => { const outsideAbove = element.bottom < containerBounds.top; const outsideBelow = element.top > containerBounds.bottom; const outsideLeft = element.right < containerBounds.left; const outsideRight = element.left > containerBounds.right; return outsideAbove || outsideBelow || outsideLeft || outsideRight; }); } /** * Gets whether an element is clipped by any of its scrolling containers. * @param element Dimensions of the element (from getBoundingClientRect) * @param scrollContainers Dimensions of element's scrolling containers (from getBoundingClientRect) * @returns Whether the element is clipped * @docs-private */ export function isElementClippedByScrolling(element, scrollContainers) { return scrollContainers.some(scrollContainerRect => { const clippedAbove = element.top < scrollContainerRect.top; const clippedBelow = element.bottom > scrollContainerRect.bottom; const clippedLeft = element.left < scrollContainerRect.left; const clippedRight = element.right > scrollContainerRect.right; return clippedAbove || clippedBelow || clippedLeft || clippedRight; }); } //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Nyb2xsLWNsaXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi9zcmMvY2RrL292ZXJsYXkvcG9zaXRpb24vc2Nyb2xsLWNsaXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBUUg7Ozs7OztHQU1HO0FBQ0gsTUFBTSxVQUFVLDRCQUE0QixDQUFDLE9BQW1CLEVBQUUsZ0JBQThCO0lBQzlGLE9BQU8sZ0JBQWdCLENBQUMsSUFBSSxDQUFDLGVBQWUsQ0FBQyxFQUFFO1FBQzdDLE1BQU0sWUFBWSxHQUFHLE9BQU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