Index: sources/gui/qml/components/Slider.qml =================================================================== diff -u -r038d30c2f22add13830b92a9775d70c9615861b2 -rd93bde7e14f9bca0315cae7d64c31f0be60722e0 --- sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision 038d30c2f22add13830b92a9775d70c9615861b2) +++ sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision d93bde7e14f9bca0315cae7d64c31f0be60722e0) @@ -99,7 +99,7 @@ // Capping values based on min/max threshold let min = calculateMinimum() - let max = calculateRoundedValue(_root.maximum) + let max = calculateMaximum() if ( newValue < min ) newValue = min if ( newValue > max ) newValue = max @@ -203,7 +203,7 @@ function calculateValue(x, isSnappingToTicks) { let mMinimum = calculateMinimum() - let mMaximum = calculatePrecisionRoundedValue(_root.maximum) + let mMaximum = calculateMaximum() // the center of the handler is aligned on the snap point and half width shall be used to set as min not the entire width. // also half of the hadler is out of slider min position when set on min, which proves the same as above. @@ -278,6 +278,19 @@ return result } + /*! + * \brief Calculate the maximum value for the slider based on the current maximum + * and stepSnap values. + * \return If stepSnap is false, then maximum. + * If stepSnap is true and maximum does not fall on a step, then one step below maximum, + * otherwise maximum. + */ + function calculateMaximum() { + let result = calculatePrecisionRoundedValue(_root.maximum) + return stepSnap ? Math.min(result, parseInt(result/step) * step) + : result + } + // used loader for performance since it may not always be required. // and can be a heavy Component Loader { id: _ticksLoader