Port constraints aren't working in some cases

Port constraints aren't working when diagram.drawOnce() method is called to draw a connector 

from one node port to other node's port

I wanted to use port constraints to make sure connector is not connecting between two input or output ports 

1 Reply

AR Aravind Ravi Syncfusion Team June 2, 2020 04:53 AM UTC

Hi Sunil, 

We have created a sample to draw connector from port. Instead of using  the drawing tools to draw connector use port draw to draw connector from one port to another port. Set port constraints as Draw so that you can be able to draw connector from port if you hover on port. To connect the connector only on node port, disable node InConnect and OutConnect constraints from node constraints. So that we cannot able to connect on node while draw connector from port. Please find the below code snippet for how to disable node constraints and how to set port constraints 

constraints: NodeConstraints.Default & ~(NodeConstraints.InConnect | NodeConstraints.OutConnect), 
    ports: [{ 
        id: 'port2', height: 10, width: 10, offset: { x: 0, y: 0.5 }, constraints: (PortConstraints.Default & PortConstraints.InConnect)| PortConstraints.Draw, 
        visibility: PortVisibility.Visible 
    }] 

We have attached a sample for your reference. Please find the sample in below link 


Regards 
Aravind Ravi 


Loader.
Up arrow icon