Index: sources/gui/qml/compounds/ValueAdjuster.qml =================================================================== diff -u -r135c320c850b09365c04e03d95195412c12fba72 -rb16fd955f65d83321decdc54bd3d5695fc81c32c --- sources/gui/qml/compounds/ValueAdjuster.qml (.../ValueAdjuster.qml) (revision 135c320c850b09365c04e03d95195412c12fba72) +++ sources/gui/qml/compounds/ValueAdjuster.qml (.../ValueAdjuster.qml) (revision b16fd955f65d83321decdc54bd3d5695fc81c32c) @@ -40,15 +40,29 @@ readonly property real maxVal : calculatePrecisionValue(maximum) readonly property real val : calculatePrecisionValue(value) - readonly property bool canIncrement : isActive ? value < maximum : true - readonly property bool canDecrement : isActive ? canOff ? value > 0 : - value > minimum : true + readonly property bool canIncrement : isActive ? val < calculateMaximum() : true + readonly property bool canDecrement : isActive ? canOff ? val > 0 : + val > calculateMinimum() : true // round the value based on the given precision (not step) function calculatePrecisionValue(value) { return Math.round(value * _private.multiplier) / _private.multiplier } + // calculate the minimum value rounded up to the next higher step size + function calculateMinimum() { + let fixedMin = _private.fixedValue(_private.minVal) + let fixedStep = _private.fixedValue(_private.stepVal) + return (Math.ceil(fixedMin / fixedStep) * fixedStep) / _private.multiplier + } + + // calculate the maximum value rounded down to the next higher step size + function calculateMaximum() { + let fixedMax = _private.fixedValue(_private.maxVal) + let fixedStep = _private.fixedValue(_private.stepVal) + return (Math.floor(fixedMax / fixedStep) * fixedStep) / _private.multiplier + } + // return a fixed point int from the inputted float (using the set precision) function fixedValue(value) { return Math.round(value * _private.multiplier)