egui_dpanel

Crates.ioegui_dpanel
lib.rsegui_dpanel
version0.1.0
sourcesrc
created_at2024-12-08 21:20:23.178345
updated_at2024-12-08 21:20:23.178345
descriptionDynamic Panels for egui
homepage
repositoryhttps://github.com/jillpls/egui_dpanel
max_upload_size
id1476724
size116,215
Jill (jillpls)

documentation

README

Dynamic Panels

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.

Commit count: 4

cargo fmt