From b9ef6523da1600a4b5b5db79ae753fd7a139c762 Mon Sep 17 00:00:00 2001 From: Tom Date: Fri, 10 Nov 2023 22:25:02 -0800 Subject: [PATCH] Fix detailer row title alignment --- detailer/src/lib.rs | 24 ++++-------------------- 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/detailer/src/lib.rs b/detailer/src/lib.rs index 44f930a..dc1aff9 100644 --- a/detailer/src/lib.rs +++ b/detailer/src/lib.rs @@ -152,12 +152,7 @@ impl<'a> Widget<'a> { let r = ui.available_size(); let text_height = egui::TextStyle::Body.resolve(ui.style()).size; - let text_rect = ui - .add_sized( - [r.x / 2., text_height], - egui::Label::new("Fixed").wrap(false), - ) - .rect; + let text_rect = ui.add(egui::Label::new("Fixed").wrap(false)).rect; ui.add_space(r.x / 2. - text_rect.width() - ui.spacing().item_spacing.x); *changed |= ui @@ -186,12 +181,7 @@ impl<'a> Widget<'a> { let r = ui.available_size(); let text_height = egui::TextStyle::Body.resolve(ui.style()).size; - let text_rect = ui - .add_sized( - [r.x / 2., text_height], - egui::Label::new("Length").wrap(false), - ) - .rect; + let text_rect = ui.add(egui::Label::new("Length").wrap(false)).rect; ui.add_space(r.x / 2. - text_rect.width() - ui.spacing().item_spacing.x); *changed |= ui @@ -244,10 +234,7 @@ impl<'a> Widget<'a> { use slotmap::Key; let text_rect = ui - .add_sized( - [r.x / 2., text_height], - egui::Label::new(format!("Point {:?}", k.data())).wrap(false), - ) + .add(egui::Label::new(format!("Point {:?}", k.data())).wrap(false)) .rect; if text_rect.width() < r.x / 2. { ui.add_space(r.x / 2. - text_rect.width()); @@ -278,10 +265,7 @@ impl<'a> Widget<'a> { let text_height = egui::TextStyle::Body.resolve(ui.style()).size; use slotmap::Key; - ui.add_sized( - [r.x / 2., text_height], - egui::Label::new(format!("Line {:?}", k.data())).wrap(false), - ); + ui.add(egui::Label::new(format!("Line {:?}", k.data())).wrap(false)); ui.with_layout(egui::Layout::right_to_left(egui::Align::TOP), |ui| { if ui.button("⊗").clicked() {