React-diagrams: Allow links based on port types

Created on 2 Nov 2018  路  3Comments  路  Source: projectstorm/react-diagrams

Would it be possible currently to have multiple 'types' of input and output ports so that only certain outputs can link with certain inputs.

So something like:
An input Inp1 which has type IA and thus only allows connections with outputs of types OA

Most helpful comment

It's a pretty easy extension of the library, I acheived this by overloading the canLinkToPort(port: SimPortModel): boolean function in my extension of PortModel. You can then add your type to this in your constructor, and implement whatever connection as to whether connection is allowed through canLinkToPort.

Good luck!

All 3 comments

It's a pretty easy extension of the library, I acheived this by overloading the canLinkToPort(port: SimPortModel): boolean function in my extension of PortModel. You can then add your type to this in your constructor, and implement whatever connection as to whether connection is allowed through canLinkToPort.

Good luck!

@cullenmcmahon Thank you for the info, this worked nicely for a specific type of link for my "top" port.

canLinkToPort(port) {
if (port.type === "PortTypeStr" && this.position === "top") {
return true;
}
return false;
}

Was this page helpful?
0 / 5 - 0 ratings

Related issues

abhijitnandy2011 picture abhijitnandy2011  路  3Comments

schecter22107 picture schecter22107  路  3Comments

M2Costa picture M2Costa  路  3Comments

Nesterov-Konstantin picture Nesterov-Konstantin  路  4Comments

msaglietto picture msaglietto  路  3Comments