From 4408893bb479dd256ba68614e86a539abeebae40 Mon Sep 17 00:00:00 2001 From: AlexKnauth Date: Fri, 1 Dec 2023 16:52:08 -0500 Subject: [PATCH] ComboBox width --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index cbfa86f..974c74e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -568,7 +568,11 @@ impl egui_dock::TabViewer for TabViewer<'_> { label.on_hover_text(&**tooltip); } - let combo_box = ComboBox::new(&setting.key, ""); + let mut opt_desc_lens: Vec = options.iter().map(|o| o.description.len()).collect(); + opt_desc_lens.sort(); + let width = 0.55 * 1.25 * 14.0 * (opt_desc_lens[(opt_desc_lens.len() * 7) / 8] as f32); + + let combo_box = ComboBox::new(&setting.key, "").width(width); let settings_map = runtime.settings_map();