This commit is contained in:
Simon Gardling 2022-04-01 02:51:31 -04:00
parent 0cbf4b5dc7
commit 8572c4b767

View File

@ -457,9 +457,6 @@ impl MathApp {
let mut integral_enabled = function.integral; let mut integral_enabled = function.integral;
let mut derivative_enabled = function.derivative; let mut derivative_enabled = function.derivative;
let mut derivative_toggle: bool = false;
let mut integral_toggle: bool = false;
// Entry for a function // Entry for a function
ui.horizontal(|ui| { ui.horizontal(|ui| {
ui.label("Function:"); ui.label("Function:");
@ -474,23 +471,25 @@ impl MathApp {
} }
// Toggle integral being enabled or not // Toggle integral being enabled or not
integral_toggle = ui integral_enabled.bitxor_assign(
.add(Button::new("")) ui.add(Button::new(""))
.on_hover_text(match integral_enabled { .on_hover_text(match integral_enabled {
true => "Don't integrate", true => "Don't integrate",
false => "Integrate", false => "Integrate",
}) })
.clicked(); .clicked(),
);
// Toggle showing the derivative (even though it's already calculated this // Toggle showing the derivative (even though it's already calculated this
// option just toggles if it's displayed or not) // option just toggles if it's displayed or not)
derivative_toggle = ui derivative_enabled.bitxor_assign(
.add(Button::new("d/dx")) ui.add(Button::new("d/dx"))
.on_hover_text(match derivative_enabled { .on_hover_text(match derivative_enabled {
true => "Don't Differentiate", true => "Don't Differentiate",
false => "Differentiate", false => "Differentiate",
}) })
.clicked(); .clicked(),
);
// Contains the function string in a text box that the user can edit // Contains the function string in a text box that the user can edit
if function.auto_complete(ui, &mut self.func_strs[i]) { if function.auto_complete(ui, &mut self.func_strs[i]) {
@ -503,9 +502,6 @@ impl MathApp {
self.exists_error = true; self.exists_error = true;
} }
integral_enabled.bitxor_assign(integral_toggle);
derivative_enabled.bitxor_assign(derivative_toggle);
let update_result = function let update_result = function
.update(&self.func_strs[i], integral_enabled, derivative_enabled) .update(&self.func_strs[i], integral_enabled, derivative_enabled)
.map(|error| (i, error)); .map(|error| (i, error));