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

How do you detect that a link should be destroyed/disconnected? #6

Closed
neverhood311 opened this issue Nov 27, 2019 · 2 comments
Closed

Comments

@neverhood311
Copy link

In the README, there's a section about checking for new links where you instruct users to call imnodes::IsLinkCreated().

Is there an equivalent function for detecting that a link should be destroyed? In Blender, when you click and drag one of the endpoints of an existing link, it disconnects the two nodes and the link follows the mouse until you reconnect it somewhere or let go of the mouse button and it disappears. Is similar functionality possible with imnodes?

@Nelarius
Copy link
Owner

Clicking and dragging an existing link to reconnect it is not currently possible with imnodes, but it is something I want to add (I'm a Blender user as well and really like the way nodes work there 😄 ).

The library follows the immediate-mode principle in that UI elements are added by simply calling Begin/End for that new element, and symmetrically they are "deleted" by just not calling Begin/End for that UI element. imnodes tries to be very stateless in this regard. So it is up to the user to decide how deleting a node or link works. You can e.g. just query the selected node and link ids and remove them from your own backing containers.

Clicking and dragging links is the one thing which doesn't sit very well with the immediate-mode principle since you have to track their state between frames. But I suppose disconnecting a link could be communicated to the user in much the same way that IsLinkCreated is done 🙂

@Nelarius
Copy link
Owner

Nelarius commented Dec 1, 2019

Created a more specific issue for the disconnect feature #11 🙂

@Nelarius Nelarius closed this as completed Dec 1, 2019
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

2 participants