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

Specify Source Node ID, Source Node Anchor, Target Node ID, Target Node Anchor in Node Connect Function #507

Open
1 task
cch264 opened this issue Mar 18, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@cch264
Copy link

cch264 commented Mar 18, 2024

Problem

I have a flow chart where each node has two inputs, and two outputs. When I want to programmatically connect a source node to a target node I am unable to utilize the Node slot connect function because the connect function only supports specifying a target node id and a target node anchor. This makes it impossible to connect a specific source node anchor to a specific target node anchor.

Programmatic connection use case: I have implemented drag and drop connection and disconnection logic to my app, which is only possible with the disconnect function and the kludge described below. It would be ideal if a more robust connect function was provided by Svelvet.

For anyone with the same dilemma, my current fix is to directly update the connections object passed to your Node components anchor with the new connection tuple. This works, but is not ideal because I am utilizing the provided disconnect function without issue, but need to use a bit of a hack to get the same functionality for adding new connections when source node has multiple output anchors.

Solution

Provide a Node connect function that allows specifying a source node connection tuple and a target node connection tuple similar to how the disconnect function is defined in the Svelvet component.

Not sure how this should be done, but I assume this functionality was left out for some reason. Is this feature on the roadmap?

Additional information

No response

👨‍👧‍👦 Contributing

  • 🙋‍♂️ Yes, I'd love to make a PR to implement this feature!
@cch264 cch264 added the enhancement New feature or request label Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant