3 * Copyright Google Inc. All Rights Reserved.
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
8 /* tslint:disable:array-type member-access variable-name typedef
9 only-arrow-functions directive-class-suffix component-class-suffix
10 component-selector no-unnecessary-type-assertion arrow-parens*/
11 /** Horizontal dimension of a connection point on the perimeter of the origin or
13 import {Optional} from '@angular/core';
14 export type HorizontalConnectionPos = 'start' | 'center' | 'end';
16 /** Vertical dimension of a connection point on the perimeter of the origin or
18 export type VerticalConnectionPos = 'top' | 'center' | 'bottom';
21 /** A connection point on the origin element. */
22 export interface OriginConnectionPosition {
23 originX: HorizontalConnectionPos;
24 originY: VerticalConnectionPos;
27 /** A connection point on the overlay element. */
28 export interface OverlayConnectionPosition {
29 overlayX: HorizontalConnectionPos;
30 overlayY: VerticalConnectionPos;
33 /** The points of the origin element and the overlay element to connect. */
34 export class ConnectionPositionPair {
35 originX: HorizontalConnectionPos;
36 originY: VerticalConnectionPos;
37 overlayX: HorizontalConnectionPos;
38 overlayY: VerticalConnectionPos;
41 origin: OriginConnectionPosition, overlay: OverlayConnectionPosition) {
42 this.originX = origin.originX;
43 this.originY = origin.originY;
44 this.overlayX = overlay.overlayX;
45 this.overlayY = overlay.overlayY;
50 * Set of properties regarding the position of the origin and overlay relative
51 * to the viewport with respect to the containing Scrollable elements.
53 * The overlay and origin are clipped if any part of their bounding client
54 * rectangle exceeds the bounds of any one of the strategy's Scrollable's
55 * bounding client rectangle.
57 * The overlay and origin are outside view if there is no overlap between their
58 * bounding client rectangle and any one of the strategy's Scrollable's bounding
61 * ----------- -----------
62 * | outside | | clipped |
63 * | view | --------------------------
65 * ---------- | ----------- |
66 * -------------------------- | |
69 * | | --------------------------
72 * --------------------------
74 export class ScrollableViewProperties {
75 isOriginClipped: boolean;
76 isOriginOutsideView: boolean;
77 isOverlayClipped: boolean;
78 isOverlayOutsideView: boolean;
81 /** The change event emitted by the strategy when a fallback position is used.
83 export class ConnectedOverlayPositionChange {
85 public connectionPair: ConnectionPositionPair,
86 @Optional() public scrollableViewProperties: ScrollableViewProperties) {}