Merge pull request #10544 from ShadowLarkens/tgui_fixes

Fix jukebox volume slider being derpy
This commit is contained in:
Aronai Sieyes
2021-06-02 16:42:07 -04:00
committed by GitHub
3 changed files with 11 additions and 10 deletions
+2 -1
View File
@@ -216,7 +216,8 @@
loop_mode = sanitize_inlist(newval, list(JUKEMODE_NEXT, JUKEMODE_RANDOM, JUKEMODE_REPEAT_SONG, JUKEMODE_PLAY_ONCE), loop_mode)
return TRUE
if("volume")
volume = clamp(params["val"], 0, 1)
var/newval = text2num(params["val"])
volume = clamp(newval, 0, 1)
update_music() // To broadcast volume change without restarting song
return TRUE
if("stop")
+8 -8
View File
@@ -93,16 +93,16 @@ export const Jukebox = (props, context) => {
<LabeledList.Item label="Volume">
<Slider
minValue={0}
step={0.01}
value={volume}
maxValue={1}
step={1}
value={volume * 100}
maxValue={100}
ranges={{
good: [.75, Infinity],
average: [.25, .75],
bad: [0, .25],
good: [75, Infinity],
average: [25, 75],
bad: [0, 25],
}}
format={val => round(val * 100, 1) + "%"}
onChange={(e, val) => act("volume", { val: round(val, 2) })} />
format={val => round(val, 1) + "%"}
onChange={(e, val) => act("volume", { val: round(val / 100, 2) })} />
</LabeledList.Item>
</LabeledList>
</Section>
File diff suppressed because one or more lines are too long