File tree Expand file tree Collapse file tree 3 files changed +29
-23
lines changed Expand file tree Collapse file tree 3 files changed +29
-23
lines changed Original file line number Diff line number Diff line change 568
568
569
569
this . step = + this . options . step ;
570
570
this . precision = + this . options . precision ;
571
+
571
572
this . scope . rzSliderModel = this . roundStep ( this . scope . rzSliderModel ) ;
572
573
if ( this . range )
573
574
this . scope . rzSliderHigh = this . roundStep ( this . scope . rzSliderHigh ) ;
574
575
575
576
this . minValue = this . roundStep ( + this . options . floor ) ;
576
- if ( this . scope . rzSliderModel < this . minValue )
577
- this . scope . rzSliderModel = this . minValue ;
578
- if ( this . range && this . scope . rzSliderHigh < this . minValue )
579
- this . scope . rzSliderHigh = this . minValue ;
580
577
581
- if ( this . options . ceil ) {
578
+ if ( this . options . ceil )
582
579
this . maxValue = this . roundStep ( + this . options . ceil ) ;
583
- if ( this . scope . rzSliderModel > this . maxValue )
584
- this . scope . rzSliderModel = this . maxValue ;
585
- if ( this . range && this . scope . rzSliderHigh > this . maxValue )
586
- this . scope . rzSliderHigh = this . maxValue ;
587
- }
588
580
else
589
581
this . maxValue = this . options . ceil = this . range ? this . scope . rzSliderHigh : this . scope . rzSliderModel ;
590
582
957
949
* @returns {number }
958
950
*/
959
951
valueToOffset : function ( val ) {
960
- return ( val - this . minValue ) * this . maxLeft / this . valueRange || 0 ;
952
+ return ( this . sanitizeOffsetValue ( val ) - this . minValue ) * this . maxLeft / this . valueRange || 0 ;
953
+ } ,
954
+
955
+ /**
956
+ * Ensure that the position rendered is within the slider bounds, even if the value is not
957
+ *
958
+ * @param {number } val
959
+ * @returns {number }
960
+ */
961
+ sanitizeOffsetValue : function ( val )
962
+ {
963
+ return Math . min ( Math . max ( val , this . minValue ) , this . maxValue ) ;
961
964
} ,
962
965
963
966
/**
You can’t perform that action at this time.
0 commit comments