Fix animation of collapsing windows

This commit is contained in:
Emil Ernerfeldt 2020-05-17 17:00:01 +02:00
parent 3737067994
commit 84099b24c9

View file

@ -136,6 +136,10 @@ impl<'open> Window<'open> {
scroll, scroll,
} = self; } = self;
if matches!(open, Some(false)) {
return None;
}
let movable = area.is_movable(); let movable = area.is_movable();
let area = area.movable(false); // We move it manually let area = area.movable(false); // We move it manually
let resizable = resize.is_resizable(); let resizable = resize.is_resizable();
@ -148,10 +152,6 @@ impl<'open> Window<'open> {
let resize = resize.id(resize_id); let resize = resize.id(resize_id);
if matches!(open, Some(false)) {
return None;
}
let frame = frame.unwrap_or_else(|| Frame::window(&ctx.style())); let frame = frame.unwrap_or_else(|| Frame::window(&ctx.style()));
let full_interact = area.show(ctx, |ui| { let full_interact = area.show(ctx, |ui| {
@ -170,9 +170,6 @@ impl<'open> Window<'open> {
collapsing_id, collapsing_id,
&mut collapsing, &mut collapsing,
); );
ui.memory()
.collapsing_headers
.insert(collapsing_id, collapsing);
// TODO: fix collapsing window animation // TODO: fix collapsing window animation
let content = collapsing.add_contents(ui, |ui| { let content = collapsing.add_contents(ui, |ui| {
@ -186,6 +183,10 @@ impl<'open> Window<'open> {
}) })
}); });
ui.memory()
.collapsing_headers
.insert(collapsing_id, collapsing);
if let Some(open) = open { if let Some(open) = open {
// Add close button now that we know our full width: // Add close button now that we know our full width: