mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
Fix the sliders that went out of range when using the arrow keys.
This commit is contained in:
parent
847fc33796
commit
c14539d63a
2 changed files with 29 additions and 6 deletions
|
@ -29,6 +29,7 @@ Item {
|
|||
|
||||
// value properties
|
||||
property real maximumValue: 100
|
||||
property real minimumValue: 0
|
||||
property bool roundValues: true
|
||||
property real handleValue: maximumValue
|
||||
|
||||
|
@ -47,6 +48,14 @@ Item {
|
|||
rangeHandle.width = handle.x - sliderRoot.handleSize
|
||||
}
|
||||
|
||||
function normalizeValue(value) {
|
||||
if (value > sliderRoot.maximumValue)
|
||||
return sliderRoot.maximumValue
|
||||
else if (value < sliderRoot.minimumValue)
|
||||
return sliderRoot.minimumValue
|
||||
return value
|
||||
}
|
||||
|
||||
// slider track
|
||||
Rectangle {
|
||||
id: track
|
||||
|
@ -110,6 +119,8 @@ Item {
|
|||
|
||||
// set the slider position based on the value
|
||||
function setValue (value) {
|
||||
// Normalize values between range, since using arrow keys will create out-of-the-range values
|
||||
value = sliderRoot.normalizeValue(value)
|
||||
|
||||
UM.SimulationView.setCurrentPath(value)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue