jerosoler / Drawflow

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

Get the information about which node is connected to w hich one #775

Open Krintox opened 8 months ago

Krintox commented 8 months ago

I want to log which node is connected to which one. How should I proceed on doing this ? Which function will give me the information about the nodeID of the source and target node. Like if I created a container A and connected to container B. Then it should show that container A -> B and if B is connected to another container which is a duplicate of A then it should show B -> A1. Can you tell me how to proceed on this? @jerosoler

jerosoler commented 8 months ago

Hi!

getNodeFromId return informatión nodes conected.

Id: example: 5

editor.getNodeFromId(5);

And use events to detect connections: connectionCreated or connectionRemoved

editor.on('connectionCreated', function(info) {
  console.log(info);
})
Krintox commented 8 months ago

THank you @jerosoler