Commit 991880dc authored by William Neely's avatar William Neely

Step rounding should be based on precision

By dividing the step by the precision you can make it so the slider jumps to the next most precise step as opposed to only whole numbers. (It doesn't make sense to have precision if it will always be forced to a whole number).
parent 270a1f84
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
* (c) Rafal Zajac <rzajac@gmail.com> * (c) Rafal Zajac <rzajac@gmail.com>
* http://github.com/rzajac/angularjs-slider * http://github.com/rzajac/angularjs-slider
* *
* Version: v0.1.6 * Version: v0.1.6r
* *
* Licensed under the MIT license * Licensed under the MIT license
*/ */
...@@ -652,7 +652,7 @@ function throttle(func, wait, options) { ...@@ -652,7 +652,7 @@ function throttle(func, wait, options) {
*/ */
roundStep: function(value) roundStep: function(value)
{ {
var step = this.step, var step = this.step/Math.pow(10,this.precision),
remainder = (value - this.minValue) % step, remainder = (value - this.minValue) % step,
steppedValue = remainder > (step / 2) ? value + step - remainder : value - remainder; steppedValue = remainder > (step / 2) ? value + step - remainder : value - remainder;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment