jerosoler / Drawflow

Simple flow library 🖥️🖱️
https://jerosoler.github.io/Drawflow/
MIT License
4.41k stars 713 forks source link

how can distribute flow in 2 part #860

Open parthsavaliya1 opened 2 months ago

parthsavaliya1 commented 2 months ago

I have a different types of node like Node 1, Node 2, Node 3 etc. but when i create break type node(Node -2) at that time is there 2 output (you can check in screenshot) and 2 plus button to add new node after this (type break) node. when i click on right side plus button at that time new node should be add right side output dot. like my new node is node 3 after node 2 and again i add one node after node 3 then new node should be add after node 3. like whenever i click on bottom plus button at that time only add node in bottom / and again if node type is break then node is insert after node -5 node then same flow should be working. how can i achieve this. and i also need to get node from where my flow is in two parts. Screenshot from 2024-04-30 10-45-24 This is my first screen shot Screenshot from 2024-04-30 10-44-27 this is second screen shot

parthsavaliya1 commented 2 months ago

@jerosoler Can you please help here?

jerosoler commented 2 months ago

I do not understand your question.

parthsavaliya1 commented 2 months ago

@jerosoler When I add node which type is break(Node 2 in first Image) .At that time in that node there is 2 output. you can check in my second image node 2 has 2 output . i want to get how many node is connected with node 2 from bottom and how many node connected with node 2 from right side.also if i again add node which type break after node 2 (in above example node 5 - type break) then again i want to get all node to connected with node 6 from bottom and right.

jerosoler commented 2 months ago

You can get the information of a node:

editor.getNodeFromId(5);

You will only see the outputs of the first node. But you can call the same function again to see the child nodes until you finish.

You can add and remove connections with the methods: addConnection and removeSingleConnection.

You can listen to events to see if a new connection is created. Events that may be of help to you: