haighcam / egui_nodes

MIT License
108 stars 30 forks source link

What does `pin::AttributeFlags::EnableLinkCreationOnSnap` do? #6

Open XBagon opened 2 years ago

XBagon commented 2 years ago

I'm having problems trying to understand what that flag does, or should do.

I just know I fairly quickly managed to crash my application with it enabled 😄. For that I had a node A with this flag and EnableLinkDetachWithDragClick activated on input and a default one B. Then connected input B->A, which produced 2 links on top of each other for some reason. So I removed both and then created a link again. When touching the input of A it crashed, cause it tried to remove a link with an index higher than available.

comcloudway commented 2 years ago

From what I can tell, reading the docs and doing some testing, it seems like without this flag, the ctx.link_created()` event is "called", once the drag is completed.

If you have the flag enabled, the event is "called", when the connection can be seen visually, but the drag has not yet been completed.

I'm now actually also experiencing the issue, where it tries to delete a link out of bound, which I solved by adding an if statement, but it also creates two connections, even without the flag enabled - going to investigate further

EDIT: Reformulated answer to state that I'm now getting the error as well