refactor: simplify CollapsingHeader enable/disable code
This commit is contained in:
parent
7ac91970bd
commit
0c9b4858f0
1 changed files with 31 additions and 34 deletions
|
@ -281,18 +281,17 @@ impl CollapsingHeader {
|
|||
ui: &mut Ui,
|
||||
add_contents: impl FnOnce(&mut Ui) -> R,
|
||||
) -> CollapsingResponse<R> {
|
||||
let header_enabled = self.enabled;
|
||||
ui.wrap(|ui| {
|
||||
ui.set_enabled(header_enabled);
|
||||
|
||||
// Make sure contents are bellow header,
|
||||
// and make sure it is one unit (necessary for putting a `CollapsingHeader` in a grid).
|
||||
ui.vertical(|ui| {
|
||||
ui.set_enabled(self.enabled);
|
||||
|
||||
let Prepared {
|
||||
id,
|
||||
header_response,
|
||||
mut state,
|
||||
} = self.begin(ui);
|
||||
|
||||
let ret_response = state.add_contents(ui, id, |ui| {
|
||||
ui.indent(id, |ui| {
|
||||
// make as wide as the header:
|
||||
|
@ -318,8 +317,6 @@ impl CollapsingHeader {
|
|||
}
|
||||
})
|
||||
.inner
|
||||
})
|
||||
.inner
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue