@@ -53,7 +53,7 @@ export class SelectPositioningStrategy extends BaseFitPositionStrategy implement
53
53
// Calculate input and selected item elements style related variables
54
54
selectFit . styles = this . calculateStyles ( selectFit ) ;
55
55
56
- selectFit . scrollAmount = this . calculateScrollPosition ( selectFit ) ;
56
+ selectFit . scrollAmount = this . calculateScrollAmount ( selectFit ) ;
57
57
// Calculate how much to offset the overlay container.
58
58
this . calculateYoffset ( selectFit ) ;
59
59
this . calculateXoffset ( selectFit ) ;
@@ -71,7 +71,7 @@ export class SelectPositioningStrategy extends BaseFitPositionStrategy implement
71
71
/**
72
72
* Calculate selected item scroll position.
73
73
*/
74
- public calculateScrollPosition ( selectFit : SelectFit ) : number {
74
+ private calculateScrollAmount ( selectFit : SelectFit ) : number {
75
75
const itemElementRect = selectFit . itemRect ;
76
76
const scrollContainer = selectFit . scrollContainer ;
77
77
const scrollContainerRect = selectFit . scrollContainerRect ;
@@ -91,14 +91,14 @@ export class SelectPositioningStrategy extends BaseFitPositionStrategy implement
91
91
* @param selectFit selectFit to use for computation.
92
92
*/
93
93
protected fitInViewport ( contentElement : HTMLElement , selectFit : SelectFit ) {
94
- const footer = selectFit . scrollContainer . getBoundingClientRect ( ) . bottom - selectFit . contentElementRect . bottom ;
95
- const header = selectFit . scrollContainer . getBoundingClientRect ( ) . top - selectFit . contentElementRect . top ;
94
+ const footer = selectFit . scrollContainerRect . bottom - selectFit . contentElementRect . bottom ;
95
+ const header = selectFit . scrollContainerRect . top - selectFit . contentElementRect . top ;
96
96
const lastItemFitSize = selectFit . targetRect . bottom + selectFit . styles . itemTextToInputTextDiff - footer ;
97
97
const firstItemFitSize = selectFit . targetRect . top - selectFit . styles . itemTextToInputTextDiff - header ;
98
98
// out of viewPort on Top
99
99
if ( selectFit . fitVertical . back < 0 ) {
100
100
const possibleScrollAmount = selectFit . scrollContainer . scrollHeight -
101
- selectFit . scrollContainer . getBoundingClientRect ( ) . height - selectFit . scrollAmount ;
101
+ selectFit . scrollContainerRect . height - selectFit . scrollAmount ;
102
102
if ( possibleScrollAmount + selectFit . fitVertical . back > 0 && firstItemFitSize > selectFit . viewPortRect . top ) {
103
103
selectFit . scrollAmount -= selectFit . fitVertical . back ;
104
104
selectFit . verticalOffset -= selectFit . fitVertical . back ;
@@ -142,8 +142,7 @@ export class SelectPositioningStrategy extends BaseFitPositionStrategy implement
142
142
const inputElementStyles = window . getComputedStyle ( this . settings . target as Element ) ;
143
143
const itemElementStyles = window . getComputedStyle ( selectFit . itemElement ) ;
144
144
const numericInputFontSize = parseFloat ( inputElementStyles . fontSize ) ;
145
- const itemFontSize = itemElementStyles . fontSize ;
146
- const numericItemFontSize = parseFloat ( itemFontSize ) ;
145
+ const numericItemFontSize = parseFloat ( itemElementStyles . fontSize ) ;
147
146
const inputTextToInputTop = ( selectFit . targetRect . bottom - selectFit . targetRect . top - numericInputFontSize ) / 2 ;
148
147
const itemTextToItemTop = ( selectFit . itemRect . height - numericItemFontSize ) / 2 ;
149
148
// Adjust for input top padding
@@ -153,10 +152,8 @@ export class SelectPositioningStrategy extends BaseFitPositionStrategy implement
153
152
) / 2 ;
154
153
styles . itemTextToInputTextDiff = Math . ceil ( itemTextToItemTop - inputTextToInputTop + negateInputPaddings ) ;
155
154
156
- const itemLeftPadding = itemElementStyles . paddingLeft ;
157
- const itemTextIndent = itemElementStyles . textIndent ;
158
- const numericLeftPadding = parseFloat ( itemLeftPadding ) ;
159
- const numericTextIndent = parseFloat ( itemTextIndent ) ;
155
+ const numericLeftPadding = parseFloat ( itemElementStyles . paddingLeft ) ;
156
+ const numericTextIndent = parseFloat ( itemElementStyles . textIndent ) ;
160
157
161
158
styles . itemTextPadding = numericLeftPadding ;
162
159
styles . itemTextIndent = numericTextIndent ;
0 commit comments