greyed out 'X' if there's only one function

This commit is contained in:
Simon Gardling 2022-03-08 09:17:07 -05:00
parent 9837f51382
commit 099ca4ca23

View File

@ -237,6 +237,7 @@ impl MathApp {
.text("Interval"),
);
let functions_len = self.functions.len();
let mut remove_i: Option<usize> = None;
for (i, function) in self.functions.iter_mut().enumerate() {
let integral_enabled = function.integral;
@ -248,6 +249,7 @@ impl MathApp {
ui.horizontal(|ui| {
ui.label("Function:");
if functions_len > 1 {
if ui
.add(Button::new("X"))
.on_hover_text("Delete Function")
@ -255,6 +257,9 @@ impl MathApp {
{
remove_i = Some(i);
}
} else {
ui.add_enabled(false, Button::new("X"));
}
integral_toggle = ui
.add(Button::new(""))