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

Bidirectional Ports

Open grafandreas opened this issue 3 years ago • 2 comments

Hi all,

I am considering to use react-diagrams for a certain use case. However, all the example's seem to have ports that are either input our output. Is it possible to create ports that are both input and output (on the same line)?

Thanks,

grafandreas avatar Jul 04 '21 09:07 grafandreas

@grafandreas hey, have you figured this out? This sounds like basic functionality to me, yet i can't figure out how to do this

mecirmartin avatar Oct 28 '21 08:10 mecirmartin

@grafandreas Hey, actually found solution for this https://github.com/projectstorm/react-diagrams/blob/23b174736c1858fa2ee5899505454bf1a408e1a7/docs/customizing/ports.md

This minimal example works

import { PortModel } from "@projectstorm/react-diagrams-core"
import { DefaultPortModel } from "@projectstorm/react-diagrams-defaults"

export class BidirectionalPortModel extends DefaultPortModel {
  canLinkToPort(port: PortModel) {
    return true
  }
}

mecirmartin avatar Oct 28 '21 18:10 mecirmartin