We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Connectors hard to connect to ports

Hello,


When the diagram is not zoomed enough, it is pretty hard to connect connectors. 

On the above example, each node has 16 ports. When one tries to change the connector target position to one of the 16 ports of one of the small box nodes, the connector seems to always want to connect to the top middle port of the big blue node. 

The target of the connector need to be exactly at the perfect pixel of the port to connect to it which is annoying. 

Is it possible to change the magnetism of the port so that the target of the connector connects to it if it is at say 5 pixels from it?

Thank you, 

3 Replies

SG Shyam G Syncfusion Team October 29, 2019 05:30 AM UTC

Hi Peter, 

When we move the connector to the node for establishing connection, it will dock to the node center. If you need to connect to a port, then you should move connector exactly to the port. It is a default behavior of the diagram control. We don’t have option to establish the connection with nearest ports in nodes, while drawing the connector at runtime. 
Also, when you need only port to port connection and to disable node to node connection, please remove InConnect and OutConnect constraints from default NodeConstraints. Please refer to a code example and modified sample. 

Code example: 
const loadDiagram = () => {  
    console.log("save is", save)  
     // iterate the nodes 
    for(let i=0; i< save.nodes.length; i++) { 
      let node = save.nodes[i]; 
      // remove the connect constraints 
      node.constraints = NodeConstraints.Default &~(NodeConstraints.InConnect | NodeConstraints.OutConnect); 
    }  
    save = JSON.stringify(save) 
    diagramInstance.loadDiagram(save) 
 



Please let us know whether an above solution satisfies your requirement?  

Regards, 
Shyam G 



AM Amatressa replied to peter March 21, 2020 05:50 PM UTC

Hello,


When the diagram is not zoomed enough, it is pretty hard to connect connectors. 

On the above example, each node has 16 ports. When one tries to change the connector target position to one of the 16 ports of one of the small box nodes, the connector seems to always want to connect to the top middle port of the big blue node. 

The target of the connector need to be exactly at the perfect pixel of the port to connect to it which is annoying. 

Is it possible to change the magnetism of the port so that the target of the connector connects to it if it is at say 5 pixels from it?

Thank you, 

Does this solutioon worked for you 
can you help me ??









SG Shyam G Syncfusion Team March 23, 2020 06:59 AM UTC

Hi Amatressa,  
 
When we move the connector to the node for establishing connection, it will dock to the node center. If you need to connect to a port, then you should move connector exactly to the port. It is a default behavior of the diagram control. We don’t have option to establish the connection with nearest ports in nodes, while drawing the connector at runtime.  
Also, when you need only port to port connection and to disable node to node connection, please remove InConnect and OutConnect constraints from defaultNodeConstraints. Please refer to a code example and modified sample.  
 
Code example:  
const loadDiagram = () => {   
    console.log("save is", save)   
     // iterate the nodes  
    for(let i=0; i< save.nodes.length; i++) {  
      let node = save.nodes[i];  
      // remove the connect constraints  
      node.constraints = NodeConstraints.Default &~(NodeConstraints.InConnect | NodeConstraints.OutConnect);  
    }   
    save = JSON.stringify(save)  
    diagramInstance.loadDiagram(save)  
   


 
 
Please let us know whether an above solution satisfies your requirement?   
 
Regards,  
Shyam G  


Loader.
Live Chat Icon For mobile
Up arrow icon