forked from Shinonome/dots-hyprland
action center: scrollable quick sliders (#2536)
This commit is contained in:
+2
@@ -33,6 +33,7 @@ ColumnLayout {
|
||||
WSlider {
|
||||
Layout.fillWidth: true
|
||||
value: root.brightnessMonitor?.brightness ?? 0
|
||||
scrollable: true
|
||||
onMoved: {
|
||||
root.brightnessMonitor?.setBrightness(value)
|
||||
}
|
||||
@@ -54,6 +55,7 @@ ColumnLayout {
|
||||
WSlider {
|
||||
Layout.fillWidth: true
|
||||
value: Audio.sink.audio.volume
|
||||
scrollable: true
|
||||
onMoved: {
|
||||
Audio.sink.audio.volume = value;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ Slider {
|
||||
|
||||
property real trackWidth: 4
|
||||
property string tooltipContent: `${Math.round(value * 100)}`
|
||||
property bool scrollable: false
|
||||
stepSize: 0.02
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
|
||||
@@ -22,10 +24,24 @@ Slider {
|
||||
}
|
||||
}
|
||||
|
||||
background: Item {
|
||||
background: MouseArea {
|
||||
id: background
|
||||
anchors.fill: parent
|
||||
|
||||
onWheel: (event) => {
|
||||
if (!root.scrollable) {
|
||||
event.accepted = false;
|
||||
return;
|
||||
}
|
||||
if (event.angleDelta.y > 0) {
|
||||
root.value = Math.min(root.value + root.stepSize, 1)
|
||||
root.moved()
|
||||
} else {
|
||||
root.value = Math.max(root.value - root.stepSize, 0)
|
||||
root.moved()
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: trackHighlight
|
||||
anchors {
|
||||
|
||||
Reference in New Issue
Block a user