sghall / react-compound-slider

:black_medium_small_square: React Compound Slider | A small React slider with no opinion on markup or styles
https://react-compound-slider.netlify.com
MIT License
626 stars 80 forks source link

Handling values and step #124

Open skyksandr opened 4 years ago

skyksandr commented 4 years ago

Hi @sghall. First of all - Thank you for your work, this is a great component to work with!

Problem or feature description:

While migrating from https://github.com/IonDen/ion.rangeSlider I faced couple of issues:

Steps to reproduce (for problems):

For the first case: Set min as 156 and max 320, step 50

I'd like to have slider starting with 156, then having ticks on 200, 250, 300 and ending with 320. With an ability to move handles to all of these possible values.

For the second case Set min as 156 and max 320, step 50 Set current value as 222 - I'd expect this value not being corrected.

Versions (for problems):

React-Compound-Slider: 2.5.0 React: 16.10 Browser: all Operating System: all

I've adjusted behaviour by inheriting from Slider and making changes to getDerivedStateFromProps and DiscreteScale.

Would you be interested in a PR that covers such cases? If so - will approach of adding a props for providing custom scale and for value auto-correction work?

dmitru commented 3 years ago

@skyksandr Hi, running in the same problem and I'd REALLY appreciate if you could share you solution!

This auto-correction behavior is quite annoying, I wish there was a way to disable it.

skyksandr commented 3 years ago

@dmitru I created a component inherited from original slider and adjusted code in scales. Have a look on