volume: reduce scroll sensitivity

Use 2% steps and accumulate wheel deltas so high-res/inertial scrolling
steps once per notch instead of firing per micro-event.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-08 21:41:02 +02:00
parent 796be77341
commit b7ea18c751

View File

@@ -17,11 +17,20 @@ MouseArea {
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
// accumulate raw wheel deltas so high-res / inertial scrolling doesn't
// fire a full step per micro-event; one notch (120 units) == one step
property real _wheelAccum: 0
readonly property real _wheelStep: 0.02
onClicked: { if (audio) audio.muted = !audio.muted; } onClicked: { if (audio) audio.muted = !audio.muted; }
onWheel: wheel => { onWheel: wheel => {
if (!audio) return; if (!audio) return;
_wheelAccum += wheel.angleDelta.y;
const notches = Math.trunc(_wheelAccum / 120);
if (notches === 0) return;
_wheelAccum -= notches * 120;
audio.volume = Math.max(0, Math.min(1, audio.volume = Math.max(0, Math.min(1,
audio.volume + (wheel.angleDelta.y > 0 ? 0.05 : -0.05))); audio.volume + notches * _wheelStep));
} }
// keep the sink's audio properties live // keep the sink's audio properties live