Open beddueimpossibile opened 3 years ago
I found out, by studying the imnodes source code, that I can use
imnodes::PushAttributeFlag(imnodes::AttributeFlags_EnableLinkDetachWithDragClick);
to enable the deletion of a link by dragging it away from a pin, but I still don't understand what's the default interaction expected to trigger a link deletion.
Hi @beddueimpossibile !
Indeed, figuring out how user interaction is supposed to work isn't the easiest thing at the moment 😞
By default, the user is responsible for deleting links. The idea is that you can delete a link by simply removing the link from your internal data structures. Nothing else needs to be done, since by default, the link is fixed in place.
IsLinkDestroyed
, like you discovered, is for situations where the user enables detach via click and drag. In this case,imnodes
signals to the user code that a link needs to be deleted through IsLinkDestroyed
. The function doesn't do anything else, since the assumption is that the link lives in the user code's data structures.
Hope this helped! And I'll try to get around to writing a bigger tutorial covering all the user interaction modes available currently.
Now it's clear, thank you for the prompt reply and the explanation! Probably I can close this issue, or leave it open to remember us about the example code covering this. I can write an example myself and send a PR after I got a little more confident with the extension, if you wish!
Yeah, we can keep it open for now.
It'd be great to have a new example submission if you have some code lying around 👍
I wonder if making using user supplied unique ids, instead of grabbing them from the pointer would help (along with other things) ?
As suggested here by @sonoro1234 https://github.com/rokups/ImNodes/issues/21#issuecomment-724657397
I wonder if making using user supplied unique ids, instead of grabbing them from the pointer would help (along with other things) ?
This was a suggestion for rokups implementation as Nelarius already takes user supplied unique ids.
Oops, the names are so similar I got confused about which one I was reading, apologies for the noise !
Where to find / how to understand the default user interaction commands? I just started exploring imnodes and successfully used
IsLinkCreated
to create links with drag and drop from one pin to an other one, but on the other side, I don't find a way to makeIsLinkDestroyed
returntrue
. I tried to push the DELETE key selecting the link and also to drag the link away from a pin without success. I don't know how to proceed in order to understand if I am not pushing the right key or if in my software the event is not triggered because of an issue or misconfiguration.