Skip to content

Commit 991880d

Browse files
committed
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).
1 parent 270a1f8 commit 991880d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

rzslider.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* (c) Rafal Zajac <[email protected]>
55
* http://github.com/rzajac/angularjs-slider
66
*
7-
* Version: v0.1.6
7+
* Version: v0.1.6r
88
*
99
* Licensed under the MIT license
1010
*/
@@ -652,7 +652,7 @@ function throttle(func, wait, options) {
652652
*/
653653
roundStep: function(value)
654654
{
655-
var step = this.step,
655+
var step = this.step/Math.pow(10,this.precision),
656656
remainder = (value - this.minValue) % step,
657657
steppedValue = remainder > (step / 2) ? value + step - remainder : value - remainder;
658658

0 commit comments

Comments
 (0)