osd: fix text not updating during transition
This commit is contained in:
parent
3d18ddcd00
commit
e52c3d82a0
1 changed files with 32 additions and 34 deletions
|
|
@ -63,45 +63,43 @@ Slider {
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
id: icon
|
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
|
animate: true
|
||||||
text: root.icon
|
text: root.icon
|
||||||
color: Colours.palette.m3inverseOnSurface
|
color: Colours.palette.m3inverseOnSurface
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
||||||
states: State {
|
Behavior on moving {
|
||||||
name: "value"
|
SequentialAnimation {
|
||||||
when: handle.moving
|
NumberAnimation {
|
||||||
|
target: icon
|
||||||
PropertyChanges {
|
property: "scale"
|
||||||
icon.animate: false
|
from: 1
|
||||||
icon.text: Math.round(root.value * 100)
|
to: 0
|
||||||
icon.font.pointSize: Appearance.font.size.small
|
duration: Appearance.anim.durations.normal / 2
|
||||||
icon.font.family: Appearance.font.family.sans
|
easing.type: Easing.BezierSpline
|
||||||
}
|
easing.bezierCurve: Appearance.anim.curves.standardAccel
|
||||||
}
|
}
|
||||||
|
ScriptAction {
|
||||||
transitions: Transition {
|
script: icon.update()
|
||||||
NumberAnimation {
|
}
|
||||||
target: icon
|
NumberAnimation {
|
||||||
property: "scale"
|
target: icon
|
||||||
from: 1
|
property: "scale"
|
||||||
to: 0
|
from: 0
|
||||||
duration: Appearance.anim.durations.normal
|
to: 1
|
||||||
easing.type: Easing.BezierSpline
|
duration: Appearance.anim.durations.normal / 2
|
||||||
easing.bezierCurve: Appearance.anim.curves.standardAccel
|
easing.type: Easing.BezierSpline
|
||||||
}
|
easing.bezierCurve: Appearance.anim.curves.standardDecel
|
||||||
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
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue