Skip to content

Commit

Permalink
update getLowerBound and getUpperBound to check startPoint prop (#683)
Browse files Browse the repository at this point in the history
* update getLowerBound and getUpperBound to check startPoint prop

* more understandable code

Co-authored-by: michael kantz <michael@3dcastor.com>
  • Loading branch information
mkantz84 and michael kantz authored Oct 31, 2020
1 parent 5746afb commit 0e161bd
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Slider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,10 +183,14 @@ class Slider extends React.Component<SliderProps, SliderState> {
}

getLowerBound() {
return this.props.min;
const minPoint = this.props.startPoint || this.props.min;
return this.state.value > minPoint ? minPoint : this.state.value;
}

getUpperBound() {
if (this.state.value < this.props.startPoint) {
return this.props.startPoint;
}
return this.state.value;
}

Expand Down

1 comment on commit 0e161bd

@vercel
Copy link

@vercel vercel bot commented on 0e161bd Oct 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.