From 7dfe1cd067ad0cad983703be5ba1aa17d8d1429e Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Tue, 12 Apr 2022 14:56:08 -0400 Subject: [PATCH] ui improvements --- src/function.rs | 2 +- src/math_app.rs | 25 +++++++++++++++---------- 2 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/function.rs b/src/function.rs index 6d25459..c2cf776 100644 --- a/src/function.rs +++ b/src/function.rs @@ -105,7 +105,7 @@ impl FunctionEntry { self.update_string(&output_string); } - pub fn settings(&mut self, ctx: &Context) { + pub fn settings_window(&mut self, ctx: &Context) { let mut invalidate_nth = false; egui::Window::new(format!("Settings: {}", self.raw_func_str)) .open(&mut self.settings_opened) diff --git a/src/math_app.rs b/src/math_app.rs index 993e26d..5616f8e 100644 --- a/src/math_app.rs +++ b/src/math_app.rs @@ -429,11 +429,10 @@ impl MathApp { let functions_len = self.functions.len(); let mut remove_i: Option = None; + ui.label("Functions:"); for (i, function) in self.functions.iter_mut().enumerate() { // Entry for a function ui.horizontal(|ui| { - ui.label("Function:"); - // There's more than 1 function! Functions can now be deleted if ui .add_enabled(functions_len > 1, Button::new("X")) @@ -476,7 +475,7 @@ impl MathApp { // Contains the function string in a text box that the user can edit function.auto_complete(ui, i) }); - function.settings(ctx); + function.settings_window(ctx); } // Remove function if the user requests it @@ -484,15 +483,21 @@ impl MathApp { self.functions.remove(remove_i_unwrap); } - // Hyperlink to project's github - ui.hyperlink_to( - "I'm Open Source!", - "https://github.com/Titaniumtown/YTBN-Graphing-Software", - ); + ui.with_layout(egui::Layout::bottom_up(emath::Align::Min), |ui| { + // Contents put in reverse order from bottom to top - // Licensing information - ui.label(RichText::new("(and licensed under AGPLv3)").color(Color32::LIGHT_GRAY)) + // Licensing information + ui.label( + RichText::new("(and licensed under AGPLv3)").color(Color32::LIGHT_GRAY), + ) .on_hover_text(&ASSETS.text_license_info); + + // Hyperlink to project's github + ui.hyperlink_to( + "I'm Open Source!", + "https://github.com/Titaniumtown/YTBN-Graphing-Software", + ); + }); }); } }