Commit 10433c4b authored by Noah Davis's avatar Noah Davis 🌵
Browse files

Animate ScrollHandle color and add pressed property

ScrollIndicator does not have a pressed property, so I can't use it
directly from the control
parent 87cfd941
......@@ -9,8 +9,10 @@ import org.kde.kirigami 2.14 as Kirigami
Rectangle {
id: root
property alias control: root.parent
// Makes this work for ScrollBar and ScrollIndicator
// ScrollIndicator does not have a policy property
property int policy: Controls.ScrollBar.AsNeeded
// ScrollIndicator does not have a pressed property
property bool pressed: false
visible: control.size < 1 && root.policy !== Controls.ScrollBar.AlwaysOff
......@@ -18,9 +20,21 @@ Rectangle {
implicitHeight: implicitWidth
radius: width / 2
color: control.pressed ? Kirigami.Theme.focusColor : Kirigami.Theme.separatorColor
opacity: root.policy === Controls.ScrollBar.AsNeeded ? 0 : 1
Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.Button
color: root.pressed ? Kirigami.Theme.focusColor : Kirigami.Theme.separatorColor
Behavior on color {
enabled: root.pressed
ColorAnimation {
duration: Kirigami.Units.shortDuration
easing.type: Easing.OutCubic
}
}
states: State {
name: "active"
when: root.policy === Controls.ScrollBar.AlwaysOn || (control.active && control.size < 1.0)
......
......@@ -28,6 +28,7 @@ T.ScrollBar {
contentItem: ScrollHandle {
control: control
policy: control.policy
pressed: control.pressed
}
background: Rectangle {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment