How to prevent deletion of node or connector in Angular Diagram using delete constraints?
In the Syncfusion Angular Diagram by using the NodeConstraints & ConnectorConstraints we can Enables/Disables certain features of nodes/connectors.
To prevent deletion of node or connector in Diagram using delete constraints, set the constraints as following for node & connectors.
<ejs-diagram #diagram id="diagram" width="100%" height="600" [nodes]="nodes" [connectors]="connectors">
</ejs-diagram>
//set constraints as delete for Node
constraints: NodeConstraints.Default & ~NodeConstraints.Delete
let nodes =
[
{
id: "heptagon",
offsetX: 100,
offsetY: 160,
width: 80,
height: 80,
constraints: NodeConstraints.Default & ~NodeConstraints.Delete
},
];
//set constraints as delete for connector
constraints: ConnectorConstraints.Default & ~ConnectorConstraints.Delete
let connectors =
[
{
id: "select",
type: 'Orthogonal',
constraints: ConnectorConstraints.Default & ~ConnectorConstraints.Delete
sourcePoint: {
x: 200,
y: 150
},
targetPoint: {
x: 320,
y: 250
}
},
];
You can find a working example of this implementation in the provided sample on StackBlitz.
Conclusion
Hope you enjoyed learning about how to prevent deletion of node or connector in Angular Diagram using delete constraints.
You can refer to our Angular Diagram feature tour page to learn about its other groundbreaking feature representations. You can explore our Angular Diagram documentation to understand how to present and manipulate data.
For current customers, you can check out our Angular 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 Angular Diagram and other Angular components.
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, Direct-Trac, or feedback portal. We are always happy to assist you!