zillow / react-slider

Accessible, CSS agnostic, slider component for React.
https://zillow.github.io/react-slider
MIT License
891 stars 232 forks source link

Added max distance and cohesion functionality to react-slider. #84

Closed billmalarky closed 4 years ago

billmalarky commented 8 years ago

This adds the "inverse" features to "min distance" and "pearling."

Namely, Setting maxDistance to greater than zero (zero means the feature is disabled) places a hard limit on how far handles can be dragged away from each other.

Cohesion works in tandem with maxDistance to allow handles to stick together after being dragged to the max distance limit. This is important in the scenario where input handle values need to fall within a specific variance of each other.

Note that cohesion plays quite well with pearling, allowing users to create sliders that can be both pushed and pulled with ease. For example, set defaultValue=[0, 20], pearling=true, minDistance=20, cohesion=true, maxDistance=20 and notice how smoothly a hard-defined section of the full range of slider values can be selected. Of course min and max distance can be manipulated easily to make the selection range more dynamic.

jkusachi commented 7 years ago

Any updates on this PR? I'd like this functionality as well

@mpowaga

billmalarky commented 7 years ago

This repo hasn't been updated in a year... Just fork my fork so you get the additional functionality but maintain control over future changes to the library (not that I plan on making additional commits to my fork).

I've been using the new logic for months now with no issues. It is stable.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.