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 {
45
45
attach ( portal : Portal < any > ) : any {
46
46
let attachResult = this . _portalHost . attach ( portal ) ;
47
47
48
+ if ( this . _state . positionStrategy ) {
49
+ this . _state . positionStrategy . attach ( this ) ;
50
+ }
51
+
48
52
// Update the pane element with the given state configuration.
49
53
this . _updateStackingOrder ( ) ;
50
54
this . updateSize ( ) ;
Original file line number Diff line number Diff line change @@ -537,6 +537,7 @@ class FakePositionStrategy implements PositionStrategy {
537
537
return Promise . resolve ( null ) ;
538
538
}
539
539
540
+ attach ( ) { }
540
541
dispose ( ) { }
541
542
}
542
543
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ import {
18
18
import { Subject } from 'rxjs/Subject' ;
19
19
import { Observable } from 'rxjs/Observable' ;
20
20
import { Scrollable } from '../scroll/scrollable' ;
21
+ import { OverlayRef } from '../overlay-ref' ;
22
+
21
23
22
24
/**
23
25
* Container to hold the bounding positions of a particular element with respect to the viewport,
@@ -39,6 +41,9 @@ type ElementBoundingPositions = {
39
41
* of the overlay.
40
42
*/
41
43
export class ConnectedPositionStrategy implements PositionStrategy {
44
+ /** The overlay to which this strategy is attached. */
45
+ private _overlayRef : OverlayRef ;
46
+
42
47
private _dir = 'ltr' ;
43
48
44
49
/** The offset in pixels for the overlay connection point on the x-axis */
@@ -89,9 +94,11 @@ export class ConnectedPositionStrategy implements PositionStrategy {
89
94
return this . _preferredPositions ;
90
95
}
91
96
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. */
95
102
dispose ( ) { }
96
103
97
104
/**
Original file line number Diff line number Diff line change 7
7
*/
8
8
9
9
import { PositionStrategy } from './position-strategy' ;
10
+ import { OverlayRef } from '../overlay-ref' ;
10
11
11
12
12
13
/**
@@ -16,6 +17,9 @@ import {PositionStrategy} from './position-strategy';
16
17
* element to become blurry.
17
18
*/
18
19
export class GlobalPositionStrategy implements PositionStrategy {
20
+ /** The overlay to which this strategy is attached. */
21
+ private _overlayRef : OverlayRef ;
22
+
19
23
private _cssPosition : string = 'static' ;
20
24
private _topOffset : string = '' ;
21
25
private _bottomOffset : string = '' ;
@@ -29,6 +33,10 @@ export class GlobalPositionStrategy implements PositionStrategy {
29
33
/* A lazily-created wrapper for the overlay element that is used as a flex container. */
30
34
private _wrapper : HTMLElement | null = null ;
31
35
36
+ attach ( overlayRef : OverlayRef ) : void {
37
+ this . _overlayRef = overlayRef ;
38
+ }
39
+
32
40
/**
33
41
* Sets the top position of the overlay. Clears any previously set vertical position.
34
42
* @param value New top offset.
Original file line number Diff line number Diff line change 6
6
* found in the LICENSE file at https://angular.io/license
7
7
*/
8
8
9
+ import { OverlayRef } from '../overlay-ref' ;
10
+
11
+
9
12
/** Strategy for setting the position on an overlay. */
10
13
export interface PositionStrategy {
11
14
15
+ /** Attaches this position strategy to an overlay. */
16
+ attach ( overlay : OverlayRef ) : void ;
17
+
12
18
/** Updates the position of the overlay element. */
13
19
apply ( element : Element ) : void ;
14
20
You can’t perform that action at this time.
0 commit comments