Index: sources/gui/qml/components/Slider.qml =================================================================== diff -u -raf8d98b36b427e2b5f4d6659fcf3b58ee79eab6a -rf3a336a173b0fc1198a2e13d9da36d06dc911fcc --- sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision af8d98b36b427e2b5f4d6659fcf3b58ee79eab6a) +++ sources/gui/qml/components/Slider.qml (.../Slider.qml) (revision f3a336a173b0fc1198a2e13d9da36d06dc911fcc) @@ -51,6 +51,39 @@ signal progressRectDragged() signal activeChanged() + function incrementValue (vInStepSegments) { + // in case the slider is not yet activated, activate + if (!isActive) { + setActive(true) + } + updateValue(vInStepSegments, true) + } + + function decrementValue (vInStepSegments) { + // in case the slider is not yet activated, activate + if (!isActive) { + setActive(true) + } + updateValue(vInStepSegments, false) + } + + function updateValue(vInStepSegments, vIsIncrement) { + let amountChanged = 1 + if (vInStepSegments) { + amountChanged = step + } + let newValue = Number.NaN + if(vIsIncrement) + newValue = _root.value + amountChanged + else + newValue = _root.value - amountChanged + + // Calculate the x position of the new value + let divisor = (maximum != minimum) ? (maximum - minimum) : 1 + let calculatedX = ((newValue - minimum) * _root.width) / divisor + setValue(calculatedX) + } + function setActive(active) { if (active) { color = Colors.createTreatmentActive