change ui stuff
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
pub mod consts;
|
||||
pub mod countdown;
|
||||
pub mod elevation;
|
||||
pub mod ui_ext;
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user