ui: fix modal bg position

This commit is contained in:
ardocrat 2023-07-11 17:53:20 +03:00
parent dc1a9e3296
commit 917b4b743d
2 changed files with 4 additions and 4 deletions

View file

@ -51,7 +51,7 @@ impl Screen for Accounts {
Navigator::to(ScreenId::Account) Navigator::to(ScreenId::Account)
}; };
if ui.button(format!("{}BACK ", ARROW_CIRCLE_LEFT)).clicked() { if ui.button(format!("{}BACK ", ARROW_CIRCLE_LEFT)).clicked() {
Navigator::to(ScreenId::Account) Navigator::back()
}; };
}); });
} }

View file

@ -107,18 +107,18 @@ impl Modal {
/// Show Modal with provided content. /// Show Modal with provided content.
pub fn ui(&self, ui: &mut egui::Ui, add_content: impl FnOnce(&mut egui::Ui, &Modal)) { pub fn ui(&self, ui: &mut egui::Ui, add_content: impl FnOnce(&mut egui::Ui, &Modal)) {
// Show background Window at full available size. let mut rect = ui.ctx().screen_rect();
egui::Window::new("modal_bg_window") egui::Window::new("modal_bg_window")
.title_bar(false) .title_bar(false)
.resizable(false) .resizable(false)
.collapsible(false) .collapsible(false)
.fixed_size(ui.ctx().used_size()) .fixed_rect(rect)
.frame(egui::Frame { .frame(egui::Frame {
fill: Colors::SEMI_TRANSPARENT, fill: Colors::SEMI_TRANSPARENT,
..Default::default() ..Default::default()
}) })
.show(ui.ctx(), |ui| { .show(ui.ctx(), |ui| {
ui.set_min_size(ui.available_size()); ui.set_min_size(rect.size());
}); });
// Choose width of modal content. // Choose width of modal content.