when added, new functions should be blank

This commit is contained in:
Simon Gardling 2022-03-02 23:54:54 -05:00
parent 50333a6f41
commit c84a98f291
2 changed files with 17 additions and 15 deletions

View File

@ -337,7 +337,8 @@ impl epi::App for MathApp {
.on_hover_text("Create and graph new function")
.clicked()
{
self.functions.push(Function::new(
self.functions.push({
let mut function = Function::new(
String::from(DEFAULT_FUNCION),
-1.0, // Doesn't matter, updated later
1.0, // Doesn't matter, updated later
@ -347,8 +348,11 @@ impl epi::App for MathApp {
None, // Doesn't matter, updated later
None, // Doesn't matter, updated later
Some(self.settings.sum),
));
self.func_strs.push(String::from(DEFAULT_FUNCION));
);
function.func_str = String::new();
function
});
self.func_strs.push(String::new());
}
if ui

View File

@ -169,9 +169,7 @@ impl Function {
pub fn run(&mut self) -> (Line, Option<(BarChart, f64)>) {
let back_values: Line = Line::new(Values::from_values(match self.back_cache.is_some() {
true => {
self.back_cache.as_ref().unwrap().clone()
}
true => self.back_cache.as_ref().unwrap().clone(),
false => {
let absrange = (self.max_x - self.min_x).abs();
let resolution: f64 = (self.pixel_width as f64 / absrange) as f64;