@@ -80,10 +80,6 @@ class Slider extends SliderBase {
80
80
return SliderTemplate ;
81
81
}
82
82
83
- static get styles ( ) {
84
- return super . styles ;
85
- }
86
-
87
83
constructor ( ) {
88
84
super ( ) ;
89
85
this . _stateStorage . value = null ;
@@ -108,7 +104,7 @@ class Slider extends SliderBase {
108
104
109
105
this . notResized = true ;
110
106
this . syncUIAndState ( "value" ) ;
111
- this . _updateUI ( this . value ) ;
107
+ this . _updateHandleAndProgress ( this . value ) ;
112
108
}
113
109
114
110
/**
@@ -123,11 +119,11 @@ class Slider extends SliderBase {
123
119
return ;
124
120
}
125
121
126
- const newValue = this . handleDownBase ( event , this . min , this . max ) ;
122
+ const newValue = this . handleDownBase ( event , this . _effectiveMin , this . _effectiveMax ) ;
127
123
128
124
// Do not yet update the Slider if press is over a handle. It will be updated if the user drags the mouse.
129
- if ( ! this . _isHandlePressed ( SliderBase . getPageXValueFromEvent ( event ) ) ) {
130
- this . _updateUI ( newValue ) ;
125
+ if ( ! this . _isHandlePressed ( this . constructor . getPageXValueFromEvent ( event ) ) ) {
126
+ this . _updateHandleAndProgress ( newValue ) ;
131
127
this . updateValue ( "value" , newValue ) ;
132
128
}
133
129
}
@@ -142,13 +138,13 @@ class Slider extends SliderBase {
142
138
143
139
// If step is 0 no interaction is available because there is no constant
144
140
// (equal for all user environments) quantitative representation of the value
145
- if ( this . disabled || this . step === 0 ) {
141
+ if ( this . disabled || this . _effectiveStep === 0 ) {
146
142
return ;
147
143
}
148
144
149
- const newValue = SliderBase . getValueFromInteraction ( event , this . step , this . min , this . max , this . getBoundingClientRect ( ) , this . directionStart ) ;
145
+ const newValue = this . constructor . getValueFromInteraction ( event , this . _effectiveStep , this . _effectiveMin , this . _effectiveMax , this . getBoundingClientRect ( ) , this . directionStart ) ;
150
146
151
- this . _updateUI ( newValue ) ;
147
+ this . _updateHandleAndProgress ( newValue ) ;
152
148
this . updateValue ( "value" , newValue ) ;
153
149
}
154
150
@@ -172,31 +168,31 @@ class Slider extends SliderBase {
172
168
}
173
169
174
170
175
- /** Updates the UI representation of the Slider according to its internal state.
171
+ /** Updates the UI representation of the progress bar and handle position
176
172
*
177
173
* @private
178
174
*/
179
- _updateUI ( newValue ) {
180
- const max = this . max ;
181
- const min = this . min ;
175
+ _updateHandleAndProgress ( newValue ) {
176
+ const max = this . _effectiveMax ;
177
+ const min = this . _effectiveMin ;
182
178
183
179
// The progress (completed) percentage of the slider.
184
- this . _percentageComplete = ( newValue - min ) / ( max - min ) ;
180
+ this . _progressPercentage = ( newValue - min ) / ( max - min ) ;
185
181
// How many pixels from the left end of the slider will be the placed the affected by the user action handle
186
- this . _handlePositionFromStart = this . _percentageComplete * 100 ;
182
+ this . _handlePositionFromStart = this . _progressPercentage * 100 ;
187
183
}
188
184
189
185
get styles ( ) {
190
186
return {
191
187
progress : {
192
- "transform" : `scaleX(${ this . _percentageComplete } )` ,
188
+ "transform" : `scaleX(${ this . _progressPercentage } )` ,
193
189
"transform-origin" : `${ this . directionStart } top` ,
194
190
} ,
195
191
handle : {
196
192
[ this . directionStart ] : `${ this . _handlePositionFromStart } %` ,
197
193
} ,
198
194
tickmarks : {
199
- "background" : `${ this . _tickmarksBackground } ` ,
195
+ "background" : `${ this . _tickmarks } ` ,
200
196
} ,
201
197
label : {
202
198
"width" : `${ this . _labelWidth } %` ,
@@ -216,7 +212,7 @@ class Slider extends SliderBase {
216
212
}
217
213
218
214
get tooltipValue ( ) {
219
- const stepPrecision = SliderBase . _getDecimalPrecisionOfNumber ( this . step ) ;
215
+ const stepPrecision = this . constructor . _getDecimalPrecisionOfNumber ( this . _effectiveStep ) ;
220
216
return this . value . toFixed ( stepPrecision ) ;
221
217
}
222
218
0 commit comments