-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decimal value for Slider step does not work #967
Comments
I'm affected by this issue too (currently using PrimeVue 2.4). From an inspection of the source it looks like the issue is cause by https://github.com/primefaces/primevue/blob/master/src/components/slider/Slider.vue It seems that these lines are rounding the value down to the nearest integer, and so fractional step values are essentially having no effect until the threshold of the next integer is reached. In my quick and dirty testing, simply changing these lines to As I say, this is a quick and dirty test, so I'm not sure what side effects this "fix" might cause, but so far I haven't seen any. The only workaround for this (i.e., without applying the above suggested fix) that I can come up with for now is to create the slider with a large enough range that the value can be scaled back to create the illusion of a fractional step. So, for example, instead of
...do this...
and then have a
...and use this "shadowed" It works but is definitely a bit "yuck". It should be able to be achieved with the
|
I have also faced with this issue. Step doesnt work (0.1, 0.01 etc) |
Sorry for the late answer. Thanks for the great feedback. Still you might need to compute your own value for the more smaller decimals. If something goes wrong again, please let me know. |
There should be no need to calculate the slider value one again. So I revert it. |
Great news! Thanks to @mertsincan for the work on this fix. |
When you use a decimal value for the step property you don't get decimal values. The value of the slider is always an integer.
I also tried using decimal values for the min and max props, but that does not make a difference.
I tried it with both Vue versions (2.x and 3.x).
Example: https://codesandbox.io/s/xenodochial-butterfly-puv1i?file=/src/components/SliderDemo.vue
The text was updated successfully, but these errors were encountered: