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