aboutsummaryrefslogtreecommitdiffstats
path: root/desktop/island/Controls.js
diff options
context:
space:
mode:
Diffstat (limited to 'desktop/island/Controls.js')
-rw-r--r--desktop/island/Controls.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/desktop/island/Controls.js b/desktop/island/Controls.js
index 39865b2..0ca2f6c 100644
--- a/desktop/island/Controls.js
+++ b/desktop/island/Controls.js
@@ -88,9 +88,14 @@ function fill(volume) {
}
// One scroll step, rounded to the percent so repeated steps do not drift.
+// The cap only stops a step up: a level already above it (set elsewhere,
+// e.g. a mic at 120% from pavucontrol) is left alone by up and stepped from
+// by down, never snapped to the cap.
function step(volume, delta, max) {
- const v = Math.round(((volume > 0 ? volume : 0) + delta) * 100) / 100;
- return Math.max(0, Math.min(max, v));
+ const cur = volume > 0 ? volume : 0;
+ const v = Math.round((cur + delta) * 100) / 100;
+ if (delta < 0) return Math.max(0, v);
+ return Math.max(cur, Math.min(max, v));
}
// The slot a dragged tile lands in, from its centre in grid coordinates.