Skip to content

Commit

Permalink
Fix detailer row title alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom committed Nov 11, 2023
1 parent 244bccb commit b9ef652
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions detailer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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());
Expand Down Expand Up @@ -278,10 +265,7 @@ impl<'a> Widget<'a> {
let text_height = egui::TextStyle::Body.resolve(ui.style()).size;

Check warning on line 265 in detailer/src/lib.rs

View workflow job for this annotation

GitHub Actions / Check wasm32

unused variable: `text_height`

Check warning on line 265 in detailer/src/lib.rs

View workflow job for this annotation

GitHub Actions / Check

unused variable: `text_height`

Check warning on line 265 in detailer/src/lib.rs

View workflow job for this annotation

GitHub Actions / Test Suite

unused variable: `text_height`

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() {
Expand Down

0 comments on commit b9ef652

Please sign in to comment.