1
0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2026-02-07 18:02:26 +00:00

Fix two bugs which caused some OnOffs to work incorrectly (#454)

This commit is contained in:
asimon-1
2022-12-31 15:02:49 -05:00
committed by GitHub
parent 7ec7928c55
commit f35f10e4f4
2 changed files with 30 additions and 30 deletions

View File

@@ -1295,9 +1295,13 @@ impl<'a> SubMenu<'a> {
let titles = T::to_toggle_strs();
for i in 0..values.len() {
let checked: bool = (values[i] & initial_value) > 0
|| (!values[i] == 0 && initial_value == &0);
|| (!values[i] == 0 && initial_value == &0);
instance.add_toggle(values[i], titles[i], checked);
}
// Select the first option if there's nothing selected atm but it's a single option submenu
if is_single_option && instance.toggles.iter().all(|t| !t.checked) {
instance.toggles[0].checked = true;
}
instance
}
pub fn new_with_slider<S: SliderTrait>(