How to disable connector selection in JavaScript Diagram?
This article explains how to disable connector selection in JavaScript Diagram. In JavaScript Diagrams, connectors are used to create links between nodes or ports to represent the relationships between them. A connector can be created by defining the source and target points of the connector. To disable connector selection, you can remove the selection constraints from the default connector constraints. This prevents users from selecting the connector when interacting with the diagram.
// Initializes the connectors for the diagram
var connectors = [
{
id: 'connector1',
sourceID: 'node1',
sourcePortID: 'port2',
targetPortID: 'port4',
targetID: 'node3',
type: 'Orthogonal',
constraints:
ej.diagrams.ConnectorConstraints.Default &
~ej.diagrams.ConnectorConstraints.Select,
annotations: [{ constraints: ej.diagrams.AnnotationConstraints.ReadOnly }],
},
];
// Initialize the diagram
diagram = new ej.diagrams.Diagram({
width: '100%',
height: '645px',
nodes: nodes,
connectors: connectors,
});
diagram.appendTo('#diagram');
Refer to the working sample for additional details and implementation: Sample
Conclusion
We hope you enjoyed learning about how to disable connector selection in JavaScript Diagram.
You can refer to our JavaScript Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started with configuration specifications. You can also explore our JavaScript Diagram example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page.
If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, BoldDesk Support, or feedback portal. We are always happy to assist you!