@@ -122,7 +122,7 @@ export class CdkStickyHeader implements OnDestroy, AfterViewInit {
122
122
} as CSSStyleDeclaration ;
123
123
124
124
this . _attachEventListeners ( ) ;
125
- this . defineRestrictionsAndStick ( ) ;
125
+ this . _updateStickyPositioning ( ) ;
126
126
}
127
127
}
128
128
@@ -148,18 +148,18 @@ export class CdkStickyHeader implements OnDestroy, AfterViewInit {
148
148
/** Add listeners for events that affect sticky positioning. */
149
149
private _attachEventListeners ( ) {
150
150
this . _onScrollSubscription = RxChain . from ( fromEvent ( this . upperScrollableContainer , 'scroll' ) )
151
- . call ( debounceTime , DEBOUNCE_TIME ) . subscribe ( ( ) => this . defineRestrictionsAndStick ( ) ) ;
151
+ . call ( debounceTime , DEBOUNCE_TIME ) . subscribe ( ( ) => this . _updateStickyPositioning ( ) ) ;
152
152
153
153
// Have to add a 'onTouchMove' listener to make sticky header work on mobile phones
154
154
this . _onTouchSubscription = RxChain . from ( fromEvent ( this . upperScrollableContainer , 'touchmove' ) )
155
- . call ( debounceTime , DEBOUNCE_TIME ) . subscribe ( ( ) => this . defineRestrictionsAndStick ( ) ) ;
155
+ . call ( debounceTime , DEBOUNCE_TIME ) . subscribe ( ( ) => this . _updateStickyPositioning ( ) ) ;
156
156
157
157
this . _onResizeSubscription = RxChain . from ( fromEvent ( this . upperScrollableContainer , 'resize' ) )
158
158
. call ( debounceTime , DEBOUNCE_TIME ) . subscribe ( ( ) => this . onResize ( ) ) ;
159
159
}
160
160
161
161
onResize ( ) : void {
162
- this . defineRestrictionsAndStick ( ) ;
162
+ this . _updateStickyPositioning ( ) ;
163
163
// If there's already a header being stick when the page is
164
164
// resized. The CSS style of the cdkStickyHeader element may be not fit
165
165
// the resized window. So we need to unstuck it then re-stick it.
@@ -257,18 +257,18 @@ export class CdkStickyHeader implements OnDestroy, AfterViewInit {
257
257
258
258
259
259
/**
260
- * 'applyStickyPositionStyles ()' function contains the main logic of sticky-header. It decides when
260
+ * '_applyStickyPositionStyles ()' function contains the main logic of sticky-header. It decides when
261
261
* a header should be stick and when should it be unstuck by comparing the offsetTop
262
262
* of scrollable container with the top and bottom of the sticky region.
263
263
*/
264
- applyStickyPositionStyles ( ) : void {
264
+ _applyStickyPositionStyles ( ) : void {
265
265
let currentPosition : number = this . upperScrollableContainer . offsetTop ;
266
266
267
267
// unstuck when the element is scrolled out of the sticky region
268
268
if ( this . isStuck &&
269
269
( currentPosition < this . _stickyRegionTop ||
270
- currentPosition > this . _stickyRegionBottomThreshold )
271
- || currentPosition >= this . _stickyRegionBottomThreshold ) {
270
+ currentPosition > this . _stickyRegionBottomThreshold ) ||
271
+ currentPosition >= this . _stickyRegionBottomThreshold ) {
272
272
this . _resetElementStyles ( ) ;
273
273
if ( currentPosition >= this . _stickyRegionBottomThreshold ) {
274
274
this . _unstickElement ( ) ;
@@ -281,8 +281,8 @@ export class CdkStickyHeader implements OnDestroy, AfterViewInit {
281
281
}
282
282
}
283
283
284
- defineRestrictionsAndStick ( ) : void {
284
+ _updateStickyPositioning ( ) : void {
285
285
this . _measureStickyRegionBounds ( ) ;
286
- this . applyStickyPositionStyles ( ) ;
286
+ this . _applyStickyPositionStyles ( ) ;
287
287
}
288
288
}
0 commit comments