This commit is contained in:
Simon Gardling 2022-04-23 16:22:50 -04:00
parent 3f323e72a1
commit 55d274d648

View File

@ -70,9 +70,10 @@ impl Manager {
); );
// if not fully open, return here as buttons cannot yet be displayed, therefore the user is inable to mark it for deletion // if not fully open, return here as buttons cannot yet be displayed, therefore the user is inable to mark it for deletion
let should_remove = if ui.ctx().animate_bool(te_id, re.has_focus()) < 1.0 { if ui.ctx().animate_bool(te_id, re.has_focus()) < 1.0 {
false continue;
} else { }
function.autocomplete.update_string(&new_string); function.autocomplete.update_string(&new_string);
if !function.autocomplete.hint.is_none() { if !function.autocomplete.hint.is_none() {
@ -131,9 +132,6 @@ impl Manager {
Button::new(text.into()).frame(false) Button::new(text.into()).frame(false)
} }
// returned at the end of this function to indicate whether or not this function should be removed from where it's stored
let mut should_remove_selected: bool = false;
/// the y offset multiplier of the `buttons_area` area /// the y offset multiplier of the `buttons_area` area
const BUTTONS_Y_OFFSET: f32 = 1.32; const BUTTONS_Y_OFFSET: f32 = 1.32;
@ -145,10 +143,13 @@ impl Manager {
|ui| { |ui| {
ui.horizontal(|ui| { ui.horizontal(|ui| {
// There's more than 1 function! Functions can now be deleted // There's more than 1 function! Functions can now be deleted
should_remove_selected = ui if ui
.add_enabled(can_remove, button_area_button("")) .add_enabled(can_remove, button_area_button(""))
.on_hover_text("Delete Function") .on_hover_text("Delete Function")
.clicked(); .clicked()
{
remove_i = Some(i);
}
// Toggle integral being enabled or not // Toggle integral being enabled or not
function.integral.bitxor_assign( function.integral.bitxor_assign(
@ -181,12 +182,6 @@ impl Manager {
}); });
}, },
); );
should_remove_selected
};
if should_remove {
remove_i = Some(i);
}
function.settings_window(ui.ctx()); function.settings_window(ui.ctx());
} }