This commit is contained in:
Simon Gardling 2022-02-24 21:14:46 -05:00
parent ee2936dfc4
commit 01b903a7ce
2 changed files with 59 additions and 41 deletions

View File

@ -36,9 +36,15 @@ impl Default for MathApp {
max_x: def_max_x, max_x: def_max_x,
num_interval: def_interval, num_interval: def_interval,
resolution: def_resolution, resolution: def_resolution,
chart_manager: ChartManager::new(def_func, def_min_x, def_max_x, def_interval, def_resolution), chart_manager: ChartManager::new(
def_func,
def_min_x,
def_max_x,
def_interval,
def_resolution,
),
back_cache: Cache::new_empty(), back_cache: Cache::new_empty(),
front_cache: Cache::new_empty() front_cache: Cache::new_empty(),
} }
} }
} }
@ -105,7 +111,7 @@ impl epi::App for MathApp {
resolution, resolution,
chart_manager, chart_manager,
back_cache, back_cache,
front_cache front_cache,
} = self; } = self;
// Note: This Instant implementation does not show microseconds when using wasm. // Note: This Instant implementation does not show microseconds when using wasm.
@ -123,7 +129,9 @@ impl epi::App for MathApp {
}); });
let mut parse_error: String = "".to_string(); let mut parse_error: String = "".to_string();
egui::SidePanel::left("side_panel").resizable(false).show(ctx, |ui| { egui::SidePanel::left("side_panel")
.resizable(false)
.show(ctx, |ui| {
ui.heading("Side Panel"); ui.heading("Side Panel");
ui.horizontal(|ui| { ui.horizontal(|ui| {
@ -136,7 +144,8 @@ impl epi::App for MathApp {
parse_error = func_test_output; parse_error = func_test_output;
} }
let min_x_old = *min_x; let min_x_old = *min_x;
let min_x_response = ui.add(egui::Slider::new(min_x, X_RANGE.clone()).text("Min X")); let min_x_response =
ui.add(egui::Slider::new(min_x, X_RANGE.clone()).text("Min X"));
let max_x_old = *max_x; let max_x_old = *max_x;
let max_x_response = ui.add(egui::Slider::new(max_x, X_RANGE).text("Max X")); let max_x_response = ui.add(egui::Slider::new(max_x, X_RANGE).text("Max X"));
@ -166,7 +175,13 @@ impl epi::App for MathApp {
// Only include hyperlink if the build doesn't have untracked files // Only include hyperlink if the build doesn't have untracked files
if !GIT_VERSION.contains("-modified") { if !GIT_VERSION.contains("-modified") {
ui.hyperlink_to(GIT_VERSION, format!("https://github.com/Titaniumtown/integral_site/commit/{}", GIT_VERSION)); ui.hyperlink_to(
GIT_VERSION,
format!(
"https://github.com/Titaniumtown/integral_site/commit/{}",
GIT_VERSION
),
);
} else { } else {
ui.label(GIT_VERSION); ui.label(GIT_VERSION);
} }
@ -175,7 +190,8 @@ impl epi::App for MathApp {
}); });
if parse_error.is_empty() { if parse_error.is_empty() {
let do_update = chart_manager.update(func_str.clone(), *min_x, *max_x, *num_interval, *resolution); let do_update =
chart_manager.update(func_str.clone(), *min_x, *max_x, *num_interval, *resolution);
// Invalidates caches according to what settings were changed // Invalidates caches according to what settings were changed
match do_update { match do_update {

View File

@ -57,7 +57,9 @@ pub fn add_asterisks(function_in: String) -> String {
add_asterisk = true; add_asterisk = true;
} }
} else if letters.contains(&c) { } else if letters.contains(&c) {
if numbers.contains(&prev_char) | (valid_variables.contains(&prev_char) && valid_variables.contains(&c)) { if numbers.contains(&prev_char)
| (valid_variables.contains(&prev_char) && valid_variables.contains(&c))
{
add_asterisk = true; add_asterisk = true;
} }
} else if (numbers.contains(&c) | c_letters_var) && prev_letters_var { } else if (numbers.contains(&c) | c_letters_var) && prev_letters_var {