- Home
- Forum
- React - EJ 2
- Hard to connect on right port
Hard to connect on right port
Hello,
Example of problem : https://stackblitz.com/edit/react-ryfhr5?file=index.js
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,
SIGN IN To post a reply.
3 Replies
SG
Shyam G
Syncfusion Team
October 29, 2019 05:32 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
PE
peter
November 5, 2019 05:29 PM UTC
Ok,
I am making a software that watches to what node a port is connected so if it is not well connected, the software will fail.
It would be very nice to implement a system to automatically connect to port if it is at a certain distance because it can be hard for a user to connect to a port.
At the moment, the only way to check if the connector is well conneted is to see if the end of the connector is white and not red which is not convenient.
SG
Shyam G
Syncfusion Team
November 6, 2019 04:03 PM UTC
Hi Peter,
We don’t have support to establish the connection with nearest node ports, while drawing the connector at runtime. We have logged “Need to provide support to establish the connection with nearest nodes, while drawing the connector at runtime” as a feature and you can track the status of the feature from the below link.
Feedback link:
Regards,
Shyam G
SIGN IN To post a reply.
- 3 Replies
- 2 Participants
-
PE peter
- Oct 28, 2019 08:10 PM UTC
- Nov 6, 2019 04:03 PM UTC