Skip to content

Commit 6c2c424

Browse files
committed
#15262: Add option which allow to define if max should be covered or not.
1 parent aa710e9 commit 6c2c424

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

ui/widgets/slider.js

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ return $.widget( "ui.slider", $.ui.mouse, {
5050
},
5151
distance: 0,
5252
max: 100,
53+
includeMax: false,
5354
min: 0,
5455
orientation: "horizontal",
5556
range: false,
@@ -554,15 +555,20 @@ return $.widget( "ui.slider", $.ui.mouse, {
554555
// Round the max before compare with max from option.
555556
max = parseFloat( max.toFixed( this._precision() ) );
556557
var optionMax = parseFloat( this.options.max.toFixed( this._precision() ) );
557-
if ( max > optionMax ) {
558+
559+
if ( this.options.includeMax) {
560+
if (max < optionMax ) {
561+
562+
// If max is not divisible by step and max from options
563+
// should be covered, add one more step.
564+
max += step;
565+
}
566+
} else if ( max > optionMax ) {
558567

559568
// If max is not divisible by step, rounding off may increase its value
560569
max -= step;
561-
} else if ( max <= ( optionMax - step ) ) {
562-
563-
// Make sure that max is covered.
564-
max += step;
565570
}
571+
566572
this.max = max;
567573
},
568574

0 commit comments

Comments
 (0)