Adding the dynamic port to Node when link come from other node port

Hi team,

Requirement: How do create dynamic port on the Node when user bring link from other node in diagram

we are evaluating gojs.net component. I have following requirements from our engineering team.

Say for example, ‘Logic Circuit emulator’.

In this sample, Gates has the default input ports (1, 2) and output ports(1) and can be linked.

User Case: Our requirement is when user draw a link into new node, that time node ports automatically create
port then linked

Thank you

Best Regards

Can you show me a picture of what you mean, before and after linking?

In particular, is there a reason you cannot use a single tall port whose fromSpot or toSpot is Spot.LeftSide or Spot.RightSide, as appropriate? That way the links are automatically spread out across the length of the port.

Also, does your app want to have a restriction that there is at most one link connected with a port? If so, that makes it difficult for the user to try to draw a new link to a node, if all of the ports were created with a link connected. There are various solutions, but that is why Simon asked for what your design envisions, before/during/after the linking operation.

Hi Simon,
Thanks for a prompt reply. Unable reply back to you (Because of Weekend off).

Please find the attached image. In this “diagram canvas”.

I have marked requirement in blue color and red color.

for sample":
I have two Nodes called Read Output on A and Read Ourput on B.

for sample I added AND gate with 2 ports as input. and it’s linked

Our requirement is AND Gate Input Ports to be created when cursor near by AND gate.

As mentioned in the diagram “RED Color and Blue color”.

Thanks for your time

Our requirement in Big Picture (Detail)

  • Ports should be Dynamic in gates / nodes

I hope you understand our requirements

Thanks is advance

Best Regards

OK, that leads to several questions.

First, do you want the “ports” to be logically distinct from each other, or only physically apart from each other? In other words, do you want to assign unique GraphObject.portId values for each port as they are created? Or can all of the links connect to a single port but be spread out with a black square at the end of each link?

Second, what should happen when the user deletes a link or disconnects a link? Should the black square remain, and should it be linkable by a newly drawn link?

Third, do you really want to do that with the outputs? I don’t think that having separate ports spread out (or alternatively a single output port with the links spread out) would look good. It depends on the shape of the node, of course. Most systems support some amount of “fan-out”.