From 28e50dd511ef6961c8a8ef305babd50cf38c5770 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 309f2ea..ef851ef 100644 --- a/src/main.rs +++ b/src/main.rs @@ -574,7 +574,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();