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

Drag and drop nodes and connect nodes with mouse #123

Closed
wanderernxa opened this issue Jul 15, 2023 · 3 comments
Closed

Drag and drop nodes and connect nodes with mouse #123

wanderernxa opened this issue Jul 15, 2023 · 3 comments

Comments

@wanderernxa
Copy link

Hi,
Thank you for the fantastic tool. Is it possible to do drag and drop of nodes from a pallette and then draw the connections(edge) between them? Like Visio for example?

thanks

@dash14
Copy link
Owner

dash14 commented Aug 6, 2023

Hi @wanderernxa,
I apologize that it has been quite some time since you asked that question.
It may not be useful anymore, but I have created a example and share it below.

https://codesandbox.io/p/sandbox/v-network-graph-make-link-by-drag-6m2tfv?file=%2Fsrc%2FApp.vue%3A1%2C1

linking.mov

It uses the layer feature, specifying raw event handlers for nodes, and the coordinate transformation feature.
See the examples below for more details on each of these features.

I am not familiar with Visio so this may not be the behavior you expect. Sorry if that is the case.
Best regards.

@wanderernxa
Copy link
Author

This is perfect, thank you so much!

@piliadis
Copy link

piliadis commented Jun 4, 2024

Hello there!
Thanks for your work @dash14 ! We all appreciate it!
I was trying to create a graph where the user can drag and drop nodes, and also link them according to the above examples.
I was getting a nasty bug: the drag and drop functionality was working perfectly, until the first edge be drawn. Then the dropped nodes were placed in the center (default behaviour). I tried to replicate the error in a sandbox, but i failed as it works as expected:
sandbox <- select the open in a new tab in the upper right corner
Fortunately I found the solution and I'm noting it here to help someone else. The solution is to avoid using reactive layouts and instead use simple ref. Then all works perfect!
Cheers!

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

3 participants