Skip to content

Commit

Permalink
Adjust sizes on menu buttons and regular buttons to make sure they match
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Jan 23, 2023
1 parent cd1ae9c commit ca1026c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion crates/egui/src/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ impl SubMenuButton {
text_galley.size().x + icon_galley.size().x,
text_galley.size().y.max(icon_galley.size().y),
);
let desired_size = text_and_icon_size + 2.0 * button_padding;
let mut desired_size = text_and_icon_size + 2.0 * button_padding;
desired_size.y = desired_size.y.at_least(ui.spacing().interact_size.y);

let (rect, response) = ui.allocate_at_least(desired_size, sense);
response.widget_info(|| {
Expand Down
2 changes: 1 addition & 1 deletion crates/egui/src/widgets/button.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ impl Widget for Button {
desired_size.x += ui.spacing().item_spacing.x + shortcut_text.size().x;
desired_size.y = desired_size.y.max(shortcut_text.size().y);
}
desired_size += 2.0 * button_padding;
if !small {
desired_size.y = desired_size.y.at_least(ui.spacing().interact_size.y);
}
desired_size += 2.0 * button_padding;
desired_size = desired_size.at_least(min_size);

let (rect, response) = ui.allocate_at_least(desired_size, sense);
Expand Down

0 comments on commit ca1026c

Please sign in to comment.