| Crates.io | egui_dpanel |
| lib.rs | egui_dpanel |
| version | 0.1.0 |
| created_at | 2024-12-08 21:20:23.178345+00 |
| updated_at | 2024-12-08 21:20:23.178345+00 |
| description | Dynamic Panels for egui |
| homepage | |
| repository | https://github.com/jillpls/egui_dpanel |
| max_upload_size | |
| id | 1476724 |
| size | 116,215 |
This crate allows creating dynamic panels in egui that are displayed with different configuration depending on a given choice function. A very simple example:
let dpanel = DynamicPanel::new("bla");
let dpanel = dpanel.with_panels(vec![
SinglePanelCfg::left().into(),
SinglePanelCfg::bottom().into(),
]);
let dpanel =
dpanel.with_choice_function(|ctx| {
if ctx.input(|i| i.screen_rect).width() < 500. {
1
} else {
0
}
});
dpanel.show_dynamic(ctx, |ui| {
ui.label("This moves!");
});
This will show a panel to the left if the context width is >= 500., otherwise it will show a panel at the bottom.