This commit is contained in:
Simon Gardling 2022-02-28 11:43:23 -05:00
parent 859603d530
commit 2831d352da

View File

@ -158,7 +158,6 @@ impl epi::App for MathApp {
ui.add(egui::Slider::new(&mut self.integral_num, INTEGRAL_NUM_RANGE).text("Interval")); ui.add(egui::Slider::new(&mut self.integral_num, INTEGRAL_NUM_RANGE).text("Interval"));
for (i, function) in self.functions.iter_mut().enumerate() { for (i, function) in self.functions.iter_mut().enumerate() {
let old_func_str = self.func_strs[i].clone();
let mut integral_toggle: bool = false; let mut integral_toggle: bool = false;
// Entry for a function // Entry for a function
@ -176,21 +175,17 @@ impl epi::App for MathApp {
function.is_integral() function.is_integral()
}; };
if !self.func_strs[i].is_empty() {
let proc_func_str = add_asterisks(self.func_strs[i].clone()); let proc_func_str = add_asterisks(self.func_strs[i].clone());
let mut do_update: bool = true;
if !self.func_strs[i].is_empty() && (proc_func_str != old_func_str) {
let func_test_output = test_func(proc_func_str.clone()); let func_test_output = test_func(proc_func_str.clone());
if !func_test_output.is_empty() { if !func_test_output.is_empty() {
parse_error += &format!("(Function #{}) ", i); parse_error += &format!("(Function #{}) ", i);
parse_error += &func_test_output; parse_error += &func_test_output;
do_update = false; } else {
}
}
if do_update {
function.update(proc_func_str, integral, Some(self.integral_min_x), Some(self.integral_max_x), Some(self.integral_num)); function.update(proc_func_str, integral, Some(self.integral_min_x), Some(self.integral_max_x), Some(self.integral_num));
} }
} }
}
// Open Source and Licensing information // Open Source and Licensing information
ui.horizontal(|ui| { ui.horizontal(|ui| {