Skip to content

Commit 9db5947

Browse files
committed
rename 'defineRestrictionsAndStick()' to '_updateStickyPositioning()'
1 parent ed2eef5 commit 9db5947

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/lib/sticky-header/sticky-header.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export class CdkStickyHeader implements OnDestroy, AfterViewInit {
122122
} as CSSStyleDeclaration;
123123

124124
this._attachEventListeners();
125-
this.defineRestrictionsAndStick();
125+
this._updateStickyPositioning();
126126
}
127127
}
128128

@@ -148,18 +148,18 @@ export class CdkStickyHeader implements OnDestroy, AfterViewInit {
148148
/** Add listeners for events that affect sticky positioning. */
149149
private _attachEventListeners() {
150150
this._onScrollSubscription = RxChain.from(fromEvent(this.upperScrollableContainer, 'scroll'))
151-
.call(debounceTime, DEBOUNCE_TIME).subscribe(() => this.defineRestrictionsAndStick());
151+
.call(debounceTime, DEBOUNCE_TIME).subscribe(() => this._updateStickyPositioning());
152152

153153
// Have to add a 'onTouchMove' listener to make sticky header work on mobile phones
154154
this._onTouchSubscription = RxChain.from(fromEvent(this.upperScrollableContainer, 'touchmove'))
155-
.call(debounceTime, DEBOUNCE_TIME).subscribe(() => this.defineRestrictionsAndStick());
155+
.call(debounceTime, DEBOUNCE_TIME).subscribe(() => this._updateStickyPositioning());
156156

157157
this._onResizeSubscription = RxChain.from(fromEvent(this.upperScrollableContainer, 'resize'))
158158
.call(debounceTime, DEBOUNCE_TIME).subscribe(() => this.onResize());
159159
}
160160

161161
onResize(): void {
162-
this.defineRestrictionsAndStick();
162+
this._updateStickyPositioning();
163163
// If there's already a header being stick when the page is
164164
// resized. The CSS style of the cdkStickyHeader element may be not fit
165165
// the resized window. So we need to unstuck it then re-stick it.
@@ -257,18 +257,18 @@ export class CdkStickyHeader implements OnDestroy, AfterViewInit {
257257

258258

259259
/**
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
261261
* a header should be stick and when should it be unstuck by comparing the offsetTop
262262
* of scrollable container with the top and bottom of the sticky region.
263263
*/
264-
applyStickyPositionStyles(): void {
264+
_applyStickyPositionStyles(): void {
265265
let currentPosition: number = this.upperScrollableContainer.offsetTop;
266266

267267
// unstuck when the element is scrolled out of the sticky region
268268
if (this.isStuck &&
269269
(currentPosition < this._stickyRegionTop ||
270-
currentPosition > this._stickyRegionBottomThreshold)
271-
|| currentPosition >= this._stickyRegionBottomThreshold) {
270+
currentPosition > this._stickyRegionBottomThreshold) ||
271+
currentPosition >= this._stickyRegionBottomThreshold) {
272272
this._resetElementStyles();
273273
if (currentPosition >= this._stickyRegionBottomThreshold) {
274274
this._unstickElement();
@@ -281,8 +281,8 @@ export class CdkStickyHeader implements OnDestroy, AfterViewInit {
281281
}
282282
}
283283

284-
defineRestrictionsAndStick(): void {
284+
_updateStickyPositioning(): void {
285285
this._measureStickyRegionBounds();
286-
this.applyStickyPositionStyles();
286+
this._applyStickyPositionStyles();
287287
}
288288
}

0 commit comments

Comments
 (0)