diff options
| author | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-02 08:37:38 +0800 |
|---|---|---|
| committer | 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> | 2025-06-02 08:37:38 +0800 |
| commit | e52c3d82a0fd1f71331dc0053f435774cda71f2a (patch) | |
| tree | 8a813fb1f55d26f2432b05e8decb21363bbc3a55 | |
| parent | bar: wifi off icon (diff) | |
| download | caelestia-shell-e52c3d82a0fd1f71331dc0053f435774cda71f2a.tar.gz caelestia-shell-e52c3d82a0fd1f71331dc0053f435774cda71f2a.tar.bz2 caelestia-shell-e52c3d82a0fd1f71331dc0053f435774cda71f2a.zip | |
osd: fix text not updating during transition
| -rw-r--r-- | widgets/VerticalSlider.qml | 66 |
1 files changed, 32 insertions, 34 deletions
diff --git a/widgets/VerticalSlider.qml b/widgets/VerticalSlider.qml index 3ee2d47..2b807a1 100644 --- a/widgets/VerticalSlider.qml +++ b/widgets/VerticalSlider.qml @@ -63,45 +63,43 @@ Slider { MaterialIcon { id: icon + property bool moving: handle.moving + + function update(): void { + animate = !moving; + text = moving ? Qt.binding(() => Math.round(root.value * 100)) : Qt.binding(() => root.icon); + font.pointSize = moving ? Appearance.font.size.small : Appearance.font.size.normal; + font.family = moving ? Appearance.font.family.sans : Appearance.font.family.material; + } + animate: true text: root.icon color: Colours.palette.m3inverseOnSurface anchors.centerIn: parent - states: State { - name: "value" - when: handle.moving - - PropertyChanges { - icon.animate: false - icon.text: Math.round(root.value * 100) - icon.font.pointSize: Appearance.font.size.small - icon.font.family: Appearance.font.family.sans - } - } - - transitions: Transition { - NumberAnimation { - target: icon - property: "scale" - from: 1 - to: 0 - duration: Appearance.anim.durations.normal - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.anim.curves.standardAccel - } - PropertyAction { - target: icon - properties: "animate,text,font.pointSize,font.family" - } - NumberAnimation { - target: icon - property: "scale" - from: 0 - to: 1 - duration: Appearance.anim.durations.normal - easing.type: Easing.BezierSpline - easing.bezierCurve: Appearance.anim.curves.standardDecel + Behavior on moving { + SequentialAnimation { + NumberAnimation { + target: icon + property: "scale" + from: 1 + to: 0 + duration: Appearance.anim.durations.normal / 2 + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standardAccel + } + ScriptAction { + script: icon.update() + } + NumberAnimation { + target: icon + property: "scale" + from: 0 + to: 1 + duration: Appearance.anim.durations.normal / 2 + easing.type: Easing.BezierSpline + easing.bezierCurve: Appearance.anim.curves.standardDecel + } } } } |