slider tumb start value validation improved

This commit is contained in:
NikolaBorislavovHristov 2019-03-22 19:05:07 +02:00
parent e852ad9ade
commit 7f208dedf6

View file

@ -79,7 +79,7 @@ class Slider extends Component {
render() {
const thumbStartProp = this.orientation === 'horizontal' ? 'left' : 'bottom';
const trackBeforeSizeProp = this.orientation === 'horizontal' ? 'width' : 'height';
const thumbStart = Math.min((this.props.value - this.props.minimumValue) / (this.props.maximumValue - this.props.minimumValue), 1);
const thumbStart = Math.max(0, Math.min(1, (this.props.value - this.props.minimumValue) / (this.props.maximumValue - this.props.minimumValue)));
return (
<div ref={this.sliderContainerRef} className={classnames(styles['slider-container'], styles[this.orientation], this.props.className)} onMouseDown={this.onStartSliding}>
<div className={styles['track']} />