From f17750f1a748960a2ed79995a4ddb5767f47e8b5 Mon Sep 17 00:00:00 2001 From: terencehill Date: Sat, 6 Jun 2020 22:01:13 +0200 Subject: [PATCH] Fix subtle bug where if you drag the handle of the master volume slider to OFF the other volume sliders remain active (whereas using the keyboard they are correctly grayed out) --- qcsrc/menu/item/slider.qc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/qcsrc/menu/item/slider.qc b/qcsrc/menu/item/slider.qc index b569c3b0c..b98f59bbb 100644 --- a/qcsrc/menu/item/slider.qc +++ b/qcsrc/menu/item/slider.qc @@ -157,8 +157,12 @@ // handle dragging me.pressed = 2; - v = median(0, (pos.x - me.pressOffset - 0.5 * me.controlWidth) / (1 - me.textSpace - me.controlWidth), 1) * (me.valueMax - me.valueMin) + me.valueMin; - if (me.valueStep) v = floor(0.5 + v / me.valueStep) * me.valueStep; + float f = bound(0, (pos.x - me.pressOffset - 0.5 * me.controlWidth) / (1 - me.textSpace - me.controlWidth), 1); + v = f * (me.valueMax - me.valueMin) + me.valueMin; + // there's no need to round min and max value... also if we did, v could be set + // to an out of bounds value due to precision errors + if (f > 0 && f < 1 && me.valueStep) + v = floor(0.5 + v / me.valueStep) * me.valueStep; me.setValue_noAnim(me, v); if(me.applyButton) if(me.previousValue != me.value) -- 2.39.2