fix settings window

This commit is contained in:
Simon Gardling 2022-05-07 02:36:55 -04:00
parent 79782d84b1
commit 6eee88bb05

View File

@ -36,6 +36,7 @@ impl FunctionManager {
.fonts() .fonts()
.row_height(&egui::FontSelection::default().resolve(ui.style())); .row_height(&egui::FontSelection::default().resolve(ui.style()));
let available_width = ui.available_width();
let mut remove_i: Option<usize> = None; let mut remove_i: Option<usize> = None;
for (i, (uuid, function)) in self.functions.iter_mut().enumerate() { for (i, (uuid, function)) in self.functions.iter_mut().enumerate() {
// render cool input box // render cool input box
@ -50,7 +51,7 @@ impl FunctionManager {
let te_id = ui.make_persistent_id(uuid); let te_id = ui.make_persistent_id(uuid);
// target size of text edit box // target size of text edit box
let target_size = vec2(ui.available_width(), { let target_size = vec2(available_width, {
// get the animated bool that stores how "in focus" the text box is // get the animated bool that stores how "in focus" the text box is
let gotten_focus_value = { let gotten_focus_value = {
let ctx = ui.ctx(); let ctx = ui.ctx();
@ -78,10 +79,7 @@ impl FunctionManager {
); );
// 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
if ui.ctx().animate_bool(te_id, re.has_focus()) < 1.0 { if ui.ctx().animate_bool(te_id, re.has_focus()) >= 1.0 {
continue;
}
function.autocomplete.update_string(&new_string); function.autocomplete.update_string(&new_string);
if !function.autocomplete.hint.is_none() { if !function.autocomplete.hint.is_none() {
@ -179,7 +177,7 @@ impl FunctionManager {
); );
function.settings_opened.bitxor_assign( function.settings_opened.bitxor_assign(
ui.add(button_area_button("".to_owned())) ui.add(button_area_button(""))
.on_hover_text(match function.settings_opened { .on_hover_text(match function.settings_opened {
true => "Close Settings", true => "Close Settings",
false => "Open Settings", false => "Open Settings",
@ -189,6 +187,7 @@ impl FunctionManager {
}); });
}, },
); );
}
function.settings_window(ui.ctx()); function.settings_window(ui.ctx());
} }