Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Troubleshooting user interaction doesn't seem trivial #60

Open
beddueimpossibile opened this issue Oct 18, 2020 · 7 comments
Open

Troubleshooting user interaction doesn't seem trivial #60

beddueimpossibile opened this issue Oct 18, 2020 · 7 comments

Comments

@beddueimpossibile
Copy link

beddueimpossibile commented Oct 18, 2020

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 make IsLinkDestroyed return true. 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.

@beddueimpossibile
Copy link
Author

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.

@Nelarius
Copy link
Owner

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.

@beddueimpossibile
Copy link
Author

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!

@Nelarius
Copy link
Owner

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 👍

@stuaxo
Copy link

stuaxo commented Nov 11, 2020

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
rokups/ImNodes#21 (comment)

@sonoro1234
Copy link
Contributor

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.

@stuaxo
Copy link

stuaxo commented Nov 11, 2020

Oops, the names are so similar I got confused about which one I was reading, apologies for the noise !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants