react-diagrams
react-diagrams copied to clipboard
Bi Directional Ports?
I am looking to build ports on my nodes that both create and accept new links. Is there support for this?
I tried by stacking both an in and an output port on top of each other, hoping that this library would figure out when I dropped ontop of the "stack", but no link gets created, and I tried making them both in or both out ports, and no link gets created between the two when using the library to make a diagram.
I tried looking at the events for creating ports and no event is fired when the link is dropped.
I think this link answers your question (I haven't tried it myself).
https://github.com/projectstorm/react-diagrams/blob/master/docs/customizing/ports.md#specifying-if-a-link-can-be-connected
@radding Have you got the answer. I can't find any solution
I just implemented this on my project
I'm learning how to manipulate this package, as result the code is very messy and duplicated, but you can see how its done on addBiPort:
https://github.com/rzfzr/mdd4/blob/a7abb0d82801be833f61da8e5c4ff1d4d9170f9c/src/components/react-diagrams/editableNode/MyEditableNodeModel.ts#L124
And how its rendered on MyPortLabelWidget:
https://github.com/rzfzr/mdd4/blob/a7abb0d82801be833f61da8e5c4ff1d4d9170f9c/src/components/react-diagrams/custom-port/MyPortLabelWidget.tsx#L46