add corner scrolling for brightness/volume

This commit is contained in:
end-4
2025-08-26 14:38:37 +07:00
parent e7ffd2455a
commit 9f4aa3f7e1
7 changed files with 89 additions and 23 deletions
@@ -19,6 +19,7 @@ MouseArea { // Right side | scroll to change volume
property real lastScrollX: 0
property real lastScrollY: 0
property bool trackingScroll: false
property real moveThreshold: 20
acceptedButtons: Qt.LeftButton
hoverEnabled: true
@@ -47,7 +48,7 @@ MouseArea { // Right side | scroll to change volume
if (root.trackingScroll) {
const dx = mouse.x - root.lastScrollX;
const dy = mouse.y - root.lastScrollY;
if (Math.sqrt(dx * dx + dy * dy) > osdHideMouseMoveThreshold) {
if (Math.sqrt(dx * dx + dy * dy) > root.moveThreshold) {
root.movedAway();
root.trackingScroll = false;
}
@@ -17,13 +17,17 @@ Item {
property bool isBottomLeft: corner === RoundCorner.CornerEnum.BottomLeft
property bool isTopRight: corner === RoundCorner.CornerEnum.TopRight
property bool isBottomRight: corner === RoundCorner.CornerEnum.BottomRight
property bool isTop: isTopLeft || isTopRight
property bool isBottom: isBottomLeft || isBottomRight
property bool isLeft: isTopLeft || isBottomLeft
property bool isRight: isTopRight || isBottomRight
Shape {
anchors {
top: (isTopLeft || isTopRight) ? parent.top : undefined
bottom: (isBottomLeft || isBottomRight) ? parent.bottom : undefined
left: (isTopLeft || isBottomLeft) ? parent.left : undefined
right: (isTopRight || isBottomRight) ? parent.right : undefined
top: root.isTop ? parent.top : undefined
bottom: root.isBottom ? parent.bottom : undefined
left: root.isLeft ? parent.left : undefined
right: root.isRight ? parent.right : undefined
}
layer.enabled: true
layer.smooth: true