File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change @@ -302,18 +302,9 @@ export default class Slider extends PureComponent<SliderProps, State> {
302
302
if ( this . thumb ) {
303
303
const { disableRTL} = this . props ;
304
304
const { trackSize} = this . state ;
305
- const _x = Constants . isRTL && disableRTL ? trackSize . width - x : x ;
306
- const position = _x - this . initialThumbSize . width / 2 ;
307
- const deviation = 3 ;
308
-
309
- if ( position + deviation < 0 ) {
310
- this . _thumbStyles . left = 0 ;
311
- } else if ( position - deviation > trackSize . width - this . initialThumbSize . width ) {
312
- this . _thumbStyles . left = trackSize . width - this . initialThumbSize . width ;
313
- } else {
314
- this . _thumbStyles . left = position ;
315
- }
316
-
305
+ const nonOverlappingTrackWidth = trackSize . width - this . initialThumbSize . width ;
306
+ const _x = Constants . isRTL && disableRTL ? nonOverlappingTrackWidth - x : x ; // adjust for RTL
307
+ this . _thumbStyles . left = trackSize . width === 0 ? _x : ( _x * nonOverlappingTrackWidth ) / trackSize . width ; // do not render above prefix\suffix icon\text
317
308
this . thumb . setNativeProps ( this . _thumbStyles ) ;
318
309
}
319
310
You can’t perform that action at this time.
0 commit comments