Connection Limit
This example shows how to implement a custom handle that can limit the number of
connections it can have. It works in tandem with the existing isConnectable
prop so you can always completely disable a handle if you need to. All you need
to do is provide a maxConnections
prop to the handle. If you leave it out, it'll
assume there's no limit.
To see it in action, try and connect Node 1
to the middle target node or Node 2
to the first target node. You'll see that it doesn't work! Try connecting both
nodes to the bottom target node that has no connection limit, and everything will
behave as normal.
If you're feeling fancy you could extend this example to let maxConnections
be a function can calculates that maximum dynamically, but we'll leave that down
to you!