diff options
Diffstat (limited to 'components')
| -rw-r--r-- | components/controls/FilledSlider.qml | 53 |
1 files changed, 31 insertions, 22 deletions
diff --git a/components/controls/FilledSlider.qml b/components/controls/FilledSlider.qml index f095a7d..4bf721a 100644 --- a/components/controls/FilledSlider.qml +++ b/components/controls/FilledSlider.qml @@ -69,7 +69,7 @@ Slider { function update(): void { animate = !moving; - text = moving ? Qt.binding(() => Math.round(root.value * 100)) : Qt.binding(() => root.icon); + binding.when = moving; font.pointSize = moving ? Appearance.font.size.small : Appearance.font.size.larger; font.family = moving ? Appearance.font.family.sans : Appearance.font.family.material; } @@ -78,27 +78,36 @@ Slider { color: Colours.palette.m3inverseOnSurface anchors.centerIn: parent - Behavior on moving { - SequentialAnimation { - Anim { - target: icon - property: "scale" - from: 1 - to: 0 - duration: Appearance.anim.durations.normal / 2 - easing.bezierCurve: Appearance.anim.curves.standardAccel - } - ScriptAction { - script: icon.update() - } - Anim { - target: icon - property: "scale" - from: 0 - to: 1 - duration: Appearance.anim.durations.normal / 2 - easing.bezierCurve: Appearance.anim.curves.standardDecel - } + onMovingChanged: anim.restart() + + Binding { + id: binding + + target: icon + property: "text" + value: Math.round(root.value * 100) + when: false + } + + SequentialAnimation { + id: anim + + Anim { + target: icon + property: "scale" + to: 0 + duration: Appearance.anim.durations.normal / 2 + easing.bezierCurve: Appearance.anim.curves.standardAccel + } + ScriptAction { + script: icon.update() + } + Anim { + target: icon + property: "scale" + to: 1 + duration: Appearance.anim.durations.normal / 2 + easing.bezierCurve: Appearance.anim.curves.standardDecel } } } |