File tree Expand file tree Collapse file tree 5 files changed +29
-3
lines changed Expand file tree Collapse file tree 5 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,10 @@ export class OverlayRef implements PortalHost {
4545 attach ( portal : Portal < any > ) : any {
4646 let attachResult = this . _portalHost . attach ( portal ) ;
4747
48+ if ( this . _state . positionStrategy ) {
49+ this . _state . positionStrategy . attach ( this ) ;
50+ }
51+
4852 // Update the pane element with the given state configuration.
4953 this . _updateStackingOrder ( ) ;
5054 this . updateSize ( ) ;
Original file line number Diff line number Diff line change @@ -537,6 +537,7 @@ class FakePositionStrategy implements PositionStrategy {
537537 return Promise . resolve ( null ) ;
538538 }
539539
540+ attach ( ) { }
540541 dispose ( ) { }
541542}
542543
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ import {
1818import { Subject } from 'rxjs/Subject' ;
1919import { Observable } from 'rxjs/Observable' ;
2020import { Scrollable } from '../scroll/scrollable' ;
21+ import { OverlayRef } from '../overlay-ref' ;
22+
2123
2224/**
2325 * Container to hold the bounding positions of a particular element with respect to the viewport,
@@ -39,6 +41,9 @@ type ElementBoundingPositions = {
3941 * of the overlay.
4042 */
4143export class ConnectedPositionStrategy implements PositionStrategy {
44+ /** The overlay to which this strategy is attached. */
45+ private _overlayRef : OverlayRef ;
46+
4247 private _dir = 'ltr' ;
4348
4449 /** The offset in pixels for the overlay connection point on the x-axis */
@@ -89,9 +94,11 @@ export class ConnectedPositionStrategy implements PositionStrategy {
8994 return this . _preferredPositions ;
9095 }
9196
92- /**
93- * To be used to for any cleanup after the element gets destroyed.
94- */
97+ attach ( overlayRef : OverlayRef ) : void {
98+ this . _overlayRef = overlayRef ;
99+ }
100+
101+ /** To be used to for any cleanup after the element gets destroyed. */
95102 dispose ( ) { }
96103
97104 /**
Original file line number Diff line number Diff line change 77 */
88
99import { PositionStrategy } from './position-strategy' ;
10+ import { OverlayRef } from '../overlay-ref' ;
1011
1112
1213/**
@@ -16,6 +17,9 @@ import {PositionStrategy} from './position-strategy';
1617 * element to become blurry.
1718 */
1819export class GlobalPositionStrategy implements PositionStrategy {
20+ /** The overlay to which this strategy is attached. */
21+ private _overlayRef : OverlayRef ;
22+
1923 private _cssPosition : string = 'static' ;
2024 private _topOffset : string = '' ;
2125 private _bottomOffset : string = '' ;
@@ -29,6 +33,10 @@ export class GlobalPositionStrategy implements PositionStrategy {
2933 /* A lazily-created wrapper for the overlay element that is used as a flex container. */
3034 private _wrapper : HTMLElement | null = null ;
3135
36+ attach ( overlayRef : OverlayRef ) : void {
37+ this . _overlayRef = overlayRef ;
38+ }
39+
3240 /**
3341 * Sets the top position of the overlay. Clears any previously set vertical position.
3442 * @param value New top offset.
Original file line number Diff line number Diff line change 66 * found in the LICENSE file at https://angular.io/license
77 */
88
9+ import { OverlayRef } from '../overlay-ref' ;
10+
11+
912/** Strategy for setting the position on an overlay. */
1013export interface PositionStrategy {
1114
15+ /** Attaches this position strategy to an overlay. */
16+ attach ( overlay : OverlayRef ) : void ;
17+
1218 /** Updates the position of the overlay element. */
1319 apply ( element : Element ) : void ;
1420
You can’t perform that action at this time.
0 commit comments