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:
@@ -17,11 +17,20 @@ MouseArea {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
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; }
|
||||
onWheel: wheel => {
|
||||
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 + (wheel.angleDelta.y > 0 ? 0.05 : -0.05)));
|
||||
audio.volume + notches * _wheelStep));
|
||||
}
|
||||
|
||||
// keep the sink's audio properties live
|
||||
|
||||
Reference in New Issue
Block a user