1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-26 14:49:06 -04:00

Smoother CollapsingHeader animation (#8177)

Animate the spacing between the header and the body. It's subtle, but
looks slightly nicer when closing a panel.
This commit is contained in:
Emil Ernerfeldt
2026-05-19 17:09:33 +02:00
committed by GitHub
parent f91b3ac10b
commit 9650ef85d6

View File

@@ -189,6 +189,8 @@ impl CollapsingState {
self.store(ui.ctx()); // we store any earlier toggling as promised in the docstring
None
} else if openness < 1.0 {
ui.add_space((openness - 1.0) * ui.spacing().item_spacing.y); // animate spacing too
Some(ui.scope_builder(builder, |child_ui| {
let max_height = if self.state.open && self.state.open_height.is_none() {
// First frame of expansion.