change ui stuff

This commit is contained in:
2025-04-08 10:50:34 +01:00
parent 99bc15b5ed
commit 6248e8379f
3 changed files with 41 additions and 5 deletions
+1
View File
@@ -1,3 +1,4 @@
pub mod consts;
pub mod countdown;
pub mod elevation;
pub mod ui_ext;
+21
View File
@@ -0,0 +1,21 @@
use eframe::egui;
pub trait UiExt {
fn add_sized_left_aligned(
&mut self,
max_size: impl Into<egui::Vec2>,
widget: impl egui::Widget,
) -> egui::Response;
}
impl UiExt for egui::Ui {
fn add_sized_left_aligned(
&mut self,
max_size: impl Into<egui::Vec2>,
widget: impl egui::Widget,
) -> egui::Response {
let layout = egui::Layout::top_down_justified(egui::Align::LEFT);
self.allocate_ui_with_layout(max_size.into(), layout, |ui| ui.add(widget))
.inner
}
}