Skip to content

Commit 8230411

Browse files
committed
rename 'defineRestrictionsAndStick()' to '_updateStickyPositioning()'
1 parent 663564b commit 8230411

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
@@ -123,7 +123,7 @@ export class CdkStickyHeader implements OnDestroy, AfterViewInit {
123123
} as CSSStyleDeclaration;
124124

125125
this._attachEventListeners();
126-
this.defineRestrictionsAndStick();
126+
this._updateStickyPositioning();
127127
}
128128
}
129129

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

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

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

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

259259

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

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

285-
defineRestrictionsAndStick(): void {
285+
_updateStickyPositioning(): void {
286286
this._measureStickyRegionBounds();
287-
this.applyStickyPositionStyles();
287+
this._applyStickyPositionStyles();
288288
}
289289
}

0 commit comments

Comments
 (0)