only test function if it changed
This commit is contained in:
parent
0520904e7e
commit
4f5a541604
@ -163,6 +163,7 @@ impl epi::App for MathApp {
|
||||
ui.add(egui::Slider::new(&mut self.integral_num, INTEGRAL_NUM_RANGE).text("Interval"));
|
||||
|
||||
for (i, function) in self.functions.iter_mut().enumerate() {
|
||||
let old_func_str = self.func_strs[i].clone();
|
||||
let mut integral_toggle: bool = false;
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("Function: ");
|
||||
@ -178,15 +179,18 @@ impl epi::App for MathApp {
|
||||
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());
|
||||
if !func_test_output.is_empty() {
|
||||
parse_error += &func_test_output;
|
||||
} else {
|
||||
function.update(proc_func_str, integral, Some(self.integral_min_x), Some(self.integral_max_x), Some(self.integral_num));
|
||||
do_update = false;
|
||||
}
|
||||
}
|
||||
if do_update {
|
||||
function.update(proc_func_str, integral, Some(self.integral_min_x), Some(self.integral_max_x), Some(self.integral_num));
|
||||
}
|
||||
}
|
||||
|
||||
// Opensource and Licensing information
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user