ui: fix modal bg position
This commit is contained in:
parent
dc1a9e3296
commit
917b4b743d
2 changed files with 4 additions and 4 deletions
|
@ -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()
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -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.
|
||||||
|
|
Loading…
Reference in a new issue