]> source.dussan.org Git - jquery-ui.git/commitdiff
Slider: fixed step alignment to handle negative fractional values. Fixed #5583 -...
authorRichard D. Worth <rdworth@gmail.com>
Tue, 11 May 2010 12:17:18 +0000 (08:17 -0400)
committerRichard D. Worth <rdworth@gmail.com>
Tue, 11 May 2010 12:17:18 +0000 (08:17 -0400)
ui/jquery.ui.slider.js

index 895b536c22a2de0e6e1dba376da8432619f5ad73..210ca769a93c245616418c8fce83d1f9a8fee0be 100644 (file)
@@ -591,12 +591,12 @@ $.widget( "ui.slider", $.ui.mouse, {
                if ( val > this._valueMax() ) {
                        return this._valueMax();
                }
-               var step = this.options.step,
+               var step = ( this.options.step > 0 ) ? this.options.step : 1,
                        valModStep = val % step,
                        alignValue = val - valModStep;
 
-               if ( valModStep >= ( step / 2 ) ) {
-                       alignValue += step;
+               if ( Math.abs(valModStep) * 2 >= step ) {
+                       alignValue += ( valModStep > 0 ) ? step : ( -step );
                }
 
                // Since JavaScript has problems with large floats, round