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,18 +337,22 @@ impl epi::App for MathApp {
.on_hover_text("Create and graph new function") .on_hover_text("Create and graph new function")
.clicked() .clicked()
{ {
self.functions.push(Function::new( self.functions.push({
String::from(DEFAULT_FUNCION), let mut function = Function::new(
-1.0, // Doesn't matter, updated later String::from(DEFAULT_FUNCION),
1.0, // Doesn't matter, updated later -1.0, // Doesn't matter, updated later
100, // Doesn't matter, updated later 1.0, // Doesn't matter, updated later
false, 100, // Doesn't matter, updated later
None, // Doesn't matter, updated later false,
None, // Doesn't matter, updated later None, // Doesn't matter, updated later
None, // Doesn't matter, updated later None, // Doesn't matter, updated later
Some(self.settings.sum), 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 if ui

View File

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