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 568568
569569 this . step = + this . options . step ;
570570 this . precision = + this . options . precision ;
571+
571572 this . scope . rzSliderModel = this . roundStep ( this . scope . rzSliderModel ) ;
572573 if ( this . range )
573574 this . scope . rzSliderHigh = this . roundStep ( this . scope . rzSliderHigh ) ;
574575
575576 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 ;
580577
581- if ( this . options . ceil ) {
578+ if ( this . options . ceil )
582579 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- }
588580 else
589581 this . maxValue = this . options . ceil = this . range ? this . scope . rzSliderHigh : this . scope . rzSliderModel ;
590582
957949 * @returns {number }
958950 */
959951 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 ) ;
961964 } ,
962965
963966 /**
You can’t perform that action at this time.
0 commit comments