seiyria / bootstrap-slider

A slider control for Bootstrap 3 & 4.
http://seiyria.github.io/bootstrap-slider/
Other
3k stars 1.14k forks source link

Can't use a minimum value of 0 with logarithmic slider #835

Closed bear454 closed 5 years ago

bear454 commented 6 years ago

Issues

NOTE: Before filing a new issue, please search through the open issues list and check to see if an existing issue already exists that describes your problem. If so, leave a comment within that issue with the checklist items described below.

Please make sure you include the following in your issue report where appropriate:

When using a logarithmic scale, 0 can not be selected on the slider. In short, log(0) = 1 :/

https://jsfiddle.net/j1LLdrhq/2/

To replicate, drag the slider off the initial '0' value, and try to drag it back to zero.

seiyria commented 6 years ago

Seems like log(0) is undefined behavior, so I'm not convinced this is a bug(?)

If you can abstract this away by using the formatter, that would be my recommendation.

bear454 commented 6 years ago

Sorry - I misstated; can we start over? :D

The issue arrises in https://github.com/seiyria/bootstrap-slider/blob/master/src/js/bootstrap-slider.js#L300

Given for example: min = 0; max = 64; percentage = 0:

min + (max - min) * percentage / 100
=> 0

Math.exp(min + (max - min) * percentage / 100)
=> 1
bear454 commented 6 years ago

@seiyria thanks for reconsidering; pull request #836 posted.