From: terencehill Date: Sat, 6 Jun 2020 20:01:13 +0000 (+0200) Subject: Fix subtle bug where if you drag the handle of the master volume slider to OFF the... X-Git-Tag: xonotic-v0.8.5~934 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f17750f1a748960a2ed79995a4ddb5767f47e8b5;p=xonotic%2Fxonotic-data.pk3dir.git 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) --- 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)