ui: optimize title panel

This commit is contained in:
ardocrat 2023-07-10 01:49:34 +03:00
parent 3e03f1a014
commit 6cfc6ae0b5

View file

@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
use egui::Id;
use egui::style::Margin;
use egui_extras::{Size, StripBuilder};
@ -35,8 +36,9 @@ impl TitlePanel {
pub const DEFAULT_HEIGHT: f32 = 52.0;
pub fn ui(title: String, l: Option<TitleAction>, r: Option<TitleAction>, ui: &mut egui::Ui) {
egui::TopBottomPanel::top("title_panel")
egui::TopBottomPanel::top(Id::from(title.clone()))
.resizable(false)
.exact_height(Self::DEFAULT_HEIGHT)
.frame(egui::Frame {
fill: Colors::YELLOW,
inner_margin: Margin::same(0.0),
@ -46,10 +48,6 @@ impl TitlePanel {
})
.show_inside(ui, |ui| {
StripBuilder::new(ui)
.size(Size::exact(Self::DEFAULT_HEIGHT))
.vertical(|mut strip| {
strip.strip(|builder| {
builder
.size(Size::exact(Self::DEFAULT_HEIGHT))
.size(Size::remainder())
.size(Size::exact(Self::DEFAULT_HEIGHT))
@ -65,8 +63,6 @@ impl TitlePanel {
});
});
});
});
});
}
fn draw_action(ui: &mut egui::Ui, action: Option<TitleAction>) {