Change shape of port dynamically

Hi GoJS team,

We are facing a issue related to change shape of port dynamically. Below are two different port shapes we would like change based on different condition.
image image

As you can see, they have different length. That means they will have different alignment related to the node.
Additionally, we also need to show these two shape in same side of node at same time.

Could you point me to some example/code to dynamic control the alignment and geometryString so that we can change port shape accordingly without messing up the alignment between ports?

Thank you very much!

The usual solution is to use a Shape with a Binding on the Shape.geometry with a conversion function that returns one of two (or more?) shared Geometry objects that were allocated upon initializing the app.

Search the samples for go.Binding("geometry.