osd: fix slider animation
This commit is contained in:
parent
3e8b7240ad
commit
469272cb48
1 changed files with 4 additions and 2 deletions
|
|
@ -9,6 +9,7 @@ Slider {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
required property string icon
|
required property string icon
|
||||||
|
property real oldValue
|
||||||
|
|
||||||
orientation: Qt.Vertical
|
orientation: Qt.Vertical
|
||||||
|
|
||||||
|
|
@ -56,7 +57,6 @@ Slider {
|
||||||
MaterialIcon {
|
MaterialIcon {
|
||||||
id: icon
|
id: icon
|
||||||
|
|
||||||
animate: true
|
|
||||||
text: root.icon
|
text: root.icon
|
||||||
color: Colours.palette.m3inverseOnSurface
|
color: Colours.palette.m3inverseOnSurface
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
@ -66,7 +66,6 @@ Slider {
|
||||||
when: handle.moving
|
when: handle.moving
|
||||||
|
|
||||||
PropertyChanges {
|
PropertyChanges {
|
||||||
icon.animate: false
|
|
||||||
icon.text: Math.round(root.value * 100)
|
icon.text: Math.round(root.value * 100)
|
||||||
icon.font.pointSize: Appearance.font.size.small
|
icon.font.pointSize: Appearance.font.size.small
|
||||||
icon.font.family: Appearance.font.family.sans
|
icon.font.family: Appearance.font.family.sans
|
||||||
|
|
@ -107,6 +106,9 @@ Slider {
|
||||||
onPressedChanged: handle.moving = pressed
|
onPressedChanged: handle.moving = pressed
|
||||||
|
|
||||||
onValueChanged: {
|
onValueChanged: {
|
||||||
|
if (Math.abs(value - oldValue) < 0.01)
|
||||||
|
return;
|
||||||
|
oldValue = value;
|
||||||
handle.moving = true;
|
handle.moving = true;
|
||||||
stateChangeDelay.restart();
|
stateChangeDelay.restart();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue