From a1905e2c5ed6e61e6a7206e005de9dda4f7135d0 Mon Sep 17 00:00:00 2001 From: Mukul Hase Date: Fri, 12 Feb 2016 00:59:54 +0530 Subject: Slider: Fixed max value miscalculation Fixes #12852 Closes gh-1664 --- ui/widgets/slider.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'ui') diff --git a/ui/widgets/slider.js b/ui/widgets/slider.js index a2da892c4..8af032dcf 100644 --- a/ui/widgets/slider.js +++ b/ui/widgets/slider.js @@ -544,8 +544,13 @@ return $.widget( "ui.slider", $.ui.mouse, { var max = this.options.max, min = this._valueMin(), step = this.options.step, - aboveMin = Math.floor( ( +( max - min ).toFixed( this._precision() ) ) / step ) * step; + aboveMin = Math.round( ( max - min ) / step ) * step; max = aboveMin + min; + if ( max > this.options.max ) { + + //If max is not divisible by step, rounding off may increase its value + max -= step; + } this.max = parseFloat( max.toFixed( this._precision() ) ); }, -- cgit v1.2.3