source: trip-planner-front/node_modules/@angular/cdk/esm2015/overlay/position/scroll-clip.js@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 6.1 KB
Line 
1/**
2 * @license
3 * Copyright Google LLC All Rights Reserved.
4 *
5 * Use of this source code is governed by an MIT-style license that can be
6 * found in the LICENSE file at https://angular.io/license
7 */
8// TODO(jelbourn): move this to live with the rest of the scrolling code
9// TODO(jelbourn): someday replace this with IntersectionObservers
10/**
11 * Gets whether an element is scrolled outside of view by any of its parent scrolling containers.
12 * @param element Dimensions of the element (from getBoundingClientRect)
13 * @param scrollContainers Dimensions of element's scrolling containers (from getBoundingClientRect)
14 * @returns Whether the element is scrolled out of view
15 * @docs-private
16 */
17export function isElementScrolledOutsideView(element, scrollContainers) {
18 return scrollContainers.some(containerBounds => {
19 const outsideAbove = element.bottom < containerBounds.top;
20 const outsideBelow = element.top > containerBounds.bottom;
21 const outsideLeft = element.right < containerBounds.left;
22 const outsideRight = element.left > containerBounds.right;
23 return outsideAbove || outsideBelow || outsideLeft || outsideRight;
24 });
25}
26/**
27 * Gets whether an element is clipped by any of its scrolling containers.
28 * @param element Dimensions of the element (from getBoundingClientRect)
29 * @param scrollContainers Dimensions of element's scrolling containers (from getBoundingClientRect)
30 * @returns Whether the element is clipped
31 * @docs-private
32 */
33export function isElementClippedByScrolling(element, scrollContainers) {
34 return scrollContainers.some(scrollContainerRect => {
35 const clippedAbove = element.top < scrollContainerRect.top;
36 const clippedBelow = element.bottom > scrollContainerRect.bottom;
37 const clippedLeft = element.left < scrollContainerRect.left;
38 const clippedRight = element.right > scrollContainerRect.right;
39 return clippedAbove || clippedBelow || clippedLeft || clippedRight;
40 });
41}
42//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2Nyb2xsLWNsaXAuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8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