This commit is contained in:
Simon Gardling 2022-03-01 19:43:28 -05:00
parent f2191b26ed
commit 74b7952cb5
3 changed files with 10 additions and 12 deletions

View File

@ -21,7 +21,7 @@ lto = false
[dependencies] [dependencies]
meval = { git = "https://github.com/Titaniumtown/meval-rs.git" } meval = { git = "https://github.com/Titaniumtown/meval-rs.git" }
eframe = { git = "https://github.com/Titaniumtown/egui", default-features = false, features = ["egui_glow"] } eframe = { git = "https://github.com/Titaniumtown/egui", branch = "patch-1", default-features = false, features = ["egui_glow"] }
git-version = "0.3.5" git-version = "0.3.5"
include-flate = { git = "https://github.com/Titaniumtown/include-flate.git" } include-flate = { git = "https://github.com/Titaniumtown/include-flate.git" }

View File

@ -251,17 +251,17 @@ impl epi::App for MathApp {
for (i, function) in self.functions.iter_mut().enumerate() { for (i, function) in self.functions.iter_mut().enumerate() {
let mut integral_toggle: bool = false; let mut integral_toggle: bool = false;
let integral_enabled = function.integral;
// Entry for a function // Entry for a function
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.label("Function: "); ui.label("Function: ");
let mut integral_opt_text = "Integrate";
if function.integral {
integral_opt_text = "Don't integrate";
}
if ui if ui
.add(Button::new("")) .add(Button::new(""))
.on_hover_text(integral_opt_text) .on_hover_text(if integral_enabled {
"Don't integrate"
} else {
"Integrate"
})
.clicked() .clicked()
{ {
integral_toggle = true; integral_toggle = true;
@ -270,9 +270,9 @@ impl epi::App for MathApp {
}); });
let integral: bool = if integral_toggle { let integral: bool = if integral_toggle {
!function.integral !integral_enabled
} else { } else {
function.integral integral_enabled
}; };
if !self.func_strs[i].is_empty() { if !self.func_strs[i].is_empty() {

View File

@ -35,9 +35,7 @@ pub fn start(canvas_id: &str) -> Result<(), wasm_bindgen::JsValue> {
// Used in order to hook into `panic!()` to log in the browser's console // Used in order to hook into `panic!()` to log in the browser's console
log_helper("Initializing panic hooks..."); log_helper("Initializing panic hooks...");
std::panic::set_hook(Box::new(|panic_info| { std::panic::set_hook(Box::new(console_error_panic_hook::hook));
console_error_panic_hook::hook(panic_info);
}));
log_helper("Initialized panic hooks!"); log_helper("Initialized panic hooks!");
log_helper("Finished initializing!"); log_helper("Finished initializing!");