ui: fix title height

This commit is contained in:
ardocrat 2023-07-15 18:54:17 +03:00
parent 2433f1f7b9
commit afdcc4dcb9
2 changed files with 4 additions and 14 deletions

View file

@ -117,18 +117,7 @@ impl Network {
}); });
} }
egui::TopBottomPanel::top("network_title") self.title_ui(ui, frame);
.exact_height(TitlePanel::DEFAULT_HEIGHT)
.resizable(false)
.frame(egui::Frame {
fill: Colors::YELLOW,
inner_margin: Margin::same(0.0),
outer_margin: Margin::same(0.0),
..Default::default()
})
.show_inside(ui, |ui| {
self.title_ui(ui, frame);
});
egui::TopBottomPanel::bottom("network_tabs") egui::TopBottomPanel::bottom("network_tabs")
.frame(egui::Frame { .frame(egui::Frame {

View file

@ -41,7 +41,7 @@ pub enum TitleType {
pub struct TitlePanel; pub struct TitlePanel;
impl TitlePanel { impl TitlePanel {
pub const DEFAULT_HEIGHT: f32 = 52.0; pub const DEFAULT_HEIGHT: f32 = 54.0;
pub fn ui(title: TitleType, l: Option<TitleAction>, r: Option<TitleAction>, ui: &mut egui::Ui) { pub fn ui(title: TitleType, l: Option<TitleAction>, r: Option<TitleAction>, ui: &mut egui::Ui) {
let id = match &title { let id = match &title {
@ -104,6 +104,7 @@ impl TitlePanel {
builder builder
.size(Size::remainder()) .size(Size::remainder())
.size(Size::exact(30.0)) .size(Size::exact(30.0))
.size(Size::exact(2.0))
.vertical(|mut strip| { .vertical(|mut strip| {
strip.cell(|ui| { strip.cell(|ui| {
ui.add_space(4.0); ui.add_space(4.0);
@ -131,8 +132,8 @@ impl TitlePanel {
ui.ctx().request_repaint(); ui.ctx().request_repaint();
} }
}); });
ui.add_space(2.0);
}); });
strip.empty();
}); });
} }
} }