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
|
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.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()
|
Behavior on moving {
|
||||||
|
|
||||||
Binding {
|
|
||||||
id: binding
|
|
||||||
|
|
||||||
target: icon
|
|
||||||
property: "text"
|
|
||||||
value: Math.round(root.value * 100)
|
|
||||||
when: false
|
|
||||||
}
|
|
||||||
|
|
||||||
SequentialAnimation {
|
SequentialAnimation {
|
||||||
id: anim
|
|
||||||
|
|
||||||
Anim {
|
Anim {
|
||||||
target: icon
|
target: icon
|
||||||
property: "scale"
|
property: "scale"
|
||||||
to: 0
|
to: 0.3
|
||||||
duration: Tokens.anim.durations.normal / 2
|
duration: Tokens.anim.durations.small / 2
|
||||||
easing: Tokens.anim.standardAccel
|
easing: Tokens.anim.standardAccel
|
||||||
}
|
}
|
||||||
ScriptAction {
|
PropertyAction {}
|
||||||
script: icon.update()
|
|
||||||
}
|
|
||||||
Anim {
|
Anim {
|
||||||
target: icon
|
target: icon
|
||||||
property: "scale"
|
property: "scale"
|
||||||
|
|
@ -112,6 +94,7 @@ Slider {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onPressedChanged: handle.moving = pressed
|
onPressedChanged: handle.moving = pressed
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,8 @@ RectangularShadow {
|
||||||
offset.y: dp / 2
|
offset.y: dp / 2
|
||||||
|
|
||||||
Behavior on dp {
|
Behavior on dp {
|
||||||
Anim {}
|
Anim {
|
||||||
|
type: Anim.SlowEffects
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue