Skip to content

Commit

Permalink
CollapsingHeader: only fill full width if it has a frame
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Jun 24, 2021
1 parent c03caa6 commit 63bddb6
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions egui/src/containers/collapsing_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,11 @@ impl CollapsingHeader {
let text_pos = available.min + vec2(ui.spacing().indent, 0.0);
let galley = label.layout_width(ui, available.right() - text_pos.x);
let text_max_x = text_pos.x + galley.size.x;
let desired_width = text_max_x + button_padding.x - available.left();
let desired_width = desired_width.max(available.width());

let mut desired_width = text_max_x + button_padding.x - available.left();
if ui.visuals().collapsing_header_frame {
desired_width = desired_width.max(available.width()); // fill full width
}

let mut desired_size = vec2(desired_width, galley.size.y + 2.0 * button_padding.y);
desired_size = desired_size.at_least(ui.spacing().interact_size);
Expand Down

0 comments on commit 63bddb6

Please sign in to comment.