projectstorm / react-diagrams

a super simple, no-nonsense diagramming library written in react that just works
https://projectstorm.cloud/react-diagrams
MIT License
8.51k stars 1.17k forks source link

Bidirectional Ports #859

Open grafandreas opened 3 years ago

grafandreas commented 3 years ago

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,

mecirmartin commented 2 years ago

@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 commented 2 years ago

@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
  }
}