nosignal-shell/widgets/StyledScrollBar.qml
2025-05-03 12:46:40 +10:00

47 lines
1.3 KiB
QML

import "root:/config"
import QtQuick
import QtQuick.Controls
ScrollBar {
id: root
contentItem: StyledRect {
opacity: root.pressed ? 0.8 : root.policy === ScrollBar.AlwaysOn || (root.active && root.size < 1) ? 0.6 : 0
radius: Appearance.rounding.full
color: Appearance.colours.m3secondary
Behavior on opacity {
NumberAnimation {
duration: Appearance.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.standard
}
}
}
background: StyledRect {
implicitWidth: 10
opacity: root.policy === ScrollBar.AlwaysOn || (root.active && root.size < 1) ? 0.4 : 0
radius: Appearance.rounding.full
color: Appearance.colours.m3surfaceContainerLow
Behavior on opacity {
NumberAnimation {
duration: Appearance.anim.durations.normal
easing.type: Easing.BezierSpline
easing.bezierCurve: Appearance.anim.curves.standard
}
}
}
MouseArea {
z: -1
anchors.fill: parent
onWheel: event => {
if (event.angleDelta.y > 0)
root.decrease();
else if (event.angleDelta.y < 0)
root.increase();
}
}
}