Skip to content

Commit

Permalink
Slider: fixed step alignment to handle negative fractional values. Fi…
Browse files Browse the repository at this point in the history
…xed #5583 - Slider displays negative fractional values incorrectly. Thanks for the patch watanabe.
  • Loading branch information
rdworth committed May 11, 2010
1 parent b7c0823 commit 34912bc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ui/jquery.ui.slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 34912bc

Please sign in to comment.