@@ -72,18 +72,6 @@ export class CdkStickyHeader implements OnDestroy, AfterViewInit {
72
72
stickyParent : HTMLElement | null ;
73
73
/** The upper scrollable container. */
74
74
upperScrollableContainer : HTMLElement ;
75
-
76
- /**
77
- * The padding of the sticky-header. Put it here to avoid calling getComputedStyle()
78
- * too many times.
79
- */
80
- padding : string ;
81
-
82
- /**
83
- * The height of the sticky-region. Put it here to avoid calling getComputedStyle()
84
- * too many times.
85
- */
86
- stickyRegionHeight : number ;
87
75
/**
88
76
* The original css of the sticky element, used to reset the sticky element
89
77
* when it is being unstuck
@@ -99,8 +87,6 @@ export class CdkStickyHeader implements OnDestroy, AfterViewInit {
99
87
* `_scrollFinish` is the place from where the stuck element should be unstuck
100
88
*/
101
89
private _scrollFinish : number ;
102
- /** The width of the sticky-header when it is stuck. */
103
- private _scrollingWidth : number ;
104
90
105
91
private _onScrollSubscription : Subscription ;
106
92
@@ -128,8 +114,6 @@ export class CdkStickyHeader implements OnDestroy, AfterViewInit {
128
114
this . getCssValue ( this . element , 'left' ) ,
129
115
this . getCssValue ( this . element , 'bottom' ) ,
130
116
this . getCssValue ( this . element , 'width' ) ) ;
131
- this . padding = this . getCssValue ( this . element , 'padding' ) ;
132
- this . stickyRegionHeight = this . getCssNumber ( this . stickyParent , 'height' ) ;
133
117
this . attach ( ) ;
134
118
this . defineRestrictionsAndStick ( ) ;
135
119
}
@@ -254,16 +238,12 @@ export class CdkStickyHeader implements OnDestroy, AfterViewInit {
254
238
if ( ! this . stickyParent ) {
255
239
return ;
256
240
}
257
- let containerTop : any = this . stickyParent . getBoundingClientRect ( ) ;
241
+ let boundingClientRect : any = this . stickyParent . getBoundingClientRect ( ) ;
258
242
let elemHeight : number = this . element . offsetHeight ;
259
- this . _containerStart = containerTop . top ;
260
-
261
- // the padding of the element being stuck
262
- let paddingNumber : any = Number ( this . padding . slice ( 0 , - 2 ) ) ;
263
- this . _scrollingWidth = this . upperScrollableContainer . clientWidth -
264
- paddingNumber - paddingNumber ;
243
+ this . _containerStart = boundingClientRect . top ;
244
+ let stickRegionHeight = boundingClientRect . height ;
265
245
266
- this . _scrollFinish = this . _containerStart + ( this . stickyRegionHeight - elemHeight ) ;
246
+ this . _scrollFinish = this . _containerStart + ( stickRegionHeight - elemHeight ) ;
267
247
}
268
248
269
249
/** Reset element to its original CSS. */
0 commit comments