blitzarx1 / egui_graphs

Interactive graph visualization widget for rust powered by egui and petgraph
https://docs.rs/crate/egui_graphs
MIT License
388 stars 29 forks source link

Rendering graph inside an egui::Window #170

Closed deft01 closed 7 months ago

deft01 commented 7 months ago

Hi,

First of all thanks for this amazing project.

My trying to accomplish a simple task. Rendering a graph inside of an egui::Window. When following your examples and rendering inside an egui::CentralPanel everything work as expected :

image

But when doing the same approach with an egui::Window it fails, and nothing show up (empty egui::Window).

image

The code of my egui::Window is the following if you want to try reproduce :

(using the "basic" example you provided but with an egui::Window)


egui::Window::new(RichText::new(format!("test_title")).color(graph.sync_color))
    .resizable(true)
    .open(&mut graph.is_visible)
    .show(ctx, |ui| {
        ui.add(&mut GraphView::<
            _,
            _,
            _,
            _,
            DefaultNodeShape,
            DefaultEdgeShape,
        >::new(&mut selector.force_directed_graph.as_mut().unwrap()));
});

Or if you could provide a working example using an egui::Window instead of an egui::CentralPanel. It could help me a lot debugging.

Versions (toml) :

egui_extras = { version = "0.25.0", features = ["svg", "image"]}
eframe = { version = "0.25.0", default-features = false, features = [
    "accesskit",     # Make egui comptaible with screen readers. NOTE: adds a lot of dependencies.
    "default_fonts", # Embed the default egui fonts.
    "glow",          # Use the glow rendering backend. Alternative: "wgpu".
    "persistence",   # Enable restoring app state when restarting the app.
] }
egui_tracing = "0.2.1"
petgraph = "0.6"
egui_graphs = { version = "0.18.0", features = ["egui_persistence"]}
blitzarx1 commented 7 months ago

Thanks for discovering this bug, fix is on its way