fix: filled sliders
This commit is contained in:
parent
eb62e47d27
commit
4ebd0fcb92
2 changed files with 24 additions and 39 deletions
|
|
@ -67,40 +67,22 @@ Slider {
|
|||
|
||||
property bool moving
|
||||
|
||||
function update(): void {
|
||||
animate = !moving;
|
||||
binding.when = moving;
|
||||
font = moving ? Tokens.font.body.small : Tokens.font.icon.large;
|
||||
}
|
||||
|
||||
text: root.icon
|
||||
color: Colours.palette.m3inverseOnSurface
|
||||
anchors.centerIn: parent
|
||||
anchors.verticalCenterOffset: 1
|
||||
text: moving ? Math.round(root.value * 100) : root.icon
|
||||
color: Colours.palette.m3inverseOnSurface
|
||||
font: moving ? Tokens.font.body.small : Tokens.font.icon.medium
|
||||
|
||||
onMovingChanged: anim.restart()
|
||||
|
||||
Binding {
|
||||
id: binding
|
||||
|
||||
target: icon
|
||||
property: "text"
|
||||
value: Math.round(root.value * 100)
|
||||
when: false
|
||||
}
|
||||
|
||||
Behavior on moving {
|
||||
SequentialAnimation {
|
||||
id: anim
|
||||
|
||||
Anim {
|
||||
target: icon
|
||||
property: "scale"
|
||||
to: 0
|
||||
duration: Tokens.anim.durations.normal / 2
|
||||
to: 0.3
|
||||
duration: Tokens.anim.durations.small / 2
|
||||
easing: Tokens.anim.standardAccel
|
||||
}
|
||||
ScriptAction {
|
||||
script: icon.update()
|
||||
}
|
||||
PropertyAction {}
|
||||
Anim {
|
||||
target: icon
|
||||
property: "scale"
|
||||
|
|
@ -112,6 +94,7 @@ Slider {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onPressedChanged: handle.moving = pressed
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@ RectangularShadow {
|
|||
offset.y: dp / 2
|
||||
|
||||
Behavior on dp {
|
||||
Anim {}
|
||||
Anim {
|
||||
type: Anim.SlowEffects
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue