react-diagrams icon indicating copy to clipboard operation
react-diagrams copied to clipboard

Bi Directional Ports?

Open radding opened this issue 3 years ago • 3 comments

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.

radding avatar Feb 05 '21 12:02 radding

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

MarkMarsh avatar Feb 21 '21 20:02 MarkMarsh

@radding Have you got the answer. I can't find any solution

amrit981 avatar Aug 17 '21 09:08 amrit981

I just implemented this on my project image 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

rzfzr avatar Mar 15 '22 19:03 rzfzr