blitzarx1 / egui_graphs

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

add_node_custom / add_edge_custom doesn't work since bind is `pub(crate)` #207

Closed XertroV closed 1 month ago

XertroV commented 1 month ago

I have some code that uses add_node_custom / add_edge_custom. While updating egui_graphs, I had to comment .bind b/c it's not public anymore. Now that it compiles, I get a crash on self.id.unwrap() (particularly in Node::id).

Looking at default_node_transform and the one for edges, it still calls .bind.

So it seems like the intent is still for the transform function to call .bind, but that's no longer possible with it being pub(crate). This doesn't seem like something I can fix from my end, and the g.add_node/edge function families don't seem to help with custom transforms.

blitzarx1 commented 1 month ago

Hi! Sorry for the long answer. This is totally a bug. I will address it soon in the upcoming Layout feature and support implicit binding or change the mechanic completely.

XertroV commented 1 month ago

no worries. As a workaround I forked master and removed the (crate) in pub(crate) fn bind.

blitzarx1 commented 1 month ago

Hi, @XertroV! I fixed this bug, removing bind mechanic in general. This is a breaking fix.

blitzarx1 commented 1 month ago

Fix is in master now.