blitzarx1/egui_graphs

Question: Is the Graph::from() function able to work with custom edges?

Atlas16A opened this issue · 3 comments

Using the NodeShapeAnimated example I tried to apply a similar setup to edges but im getting a type error on every use of Graph::from() and is clear its trying to return one with a default edge.

   --> src/main.rs:540:16
    |
540 |             g: Graph::from(&g),
    |                ^^^^^^^^^^^^^^^ expected `Graph<(), (), ..., ..., ..., ...>`, found `Graph<_, _, Directed, u32, _>`
    |
    = note: expected struct `egui_graphs::Graph<(), (), _, _, node::NodeShape, edge::EdgeShape>`
               found struct `egui_graphs::Graph<_, _, _, _, _, egui_graphs::DefaultEdgeShape>`

Hey! Sorry for long response. You can check examples/custom_draw Graph::from is used there with NodeShapeAnimated. All you need to do is to explicitly set NodeShapeAnimated in the Graph signature. Please check example. If this does not help please post here your code with this error.

Ah, I wasnt very clear, what i mean to say is that Ive already used NodeShapeAnimated and modified it some, what Im currently working on is EdgeShape and changing that, I copied the defaultedgeshape and applyed it to the same formating that NodeShapeAnimated has.

You can view my code here https://github.com/Atlas16A/LSegui/blob/master/src/main.rs
The relevant lines are, 14-19, 517, and 946, in the main.rs file and 14, 25, and 41 in the edge.rs file.

My NodeShape works perfectly fine by itself however my EdgeShape creates the error above, when added, on all the Graph::from() functions.

Yep, this is the bug. I ' ve already fixed it. Please check master.