How to Add Annotation Constraints in Angular Diagram?
This article explains how to add annotation constraints in Angular Diagram. We will explore how to apply annotation constraints to dynamically added annotations during the TextEdit event in the Angular Diagram component.
When you double-click an annotation on a node or connector, an edit box appears, allowing you to modify its content. Once the content is edited, the TextEdit event is triggered. During this event, you can retrieve the modified node or connector object and apply annotation constraints to it.
Below is the sample code to handle modifications during the TextEdit event:
public textEdit = function (args: ITextEditEventArgs): void {
let element = args.element;
if (element && element.annotations) {
if (element.annotations.length > 0) {
element.annotations[0].constraints =
AnnotationConstraints.Interaction | AnnotationConstraints.Drag;
}
}
};
Explanation of the code:
- After editing, the modified node or connector is accessed via
args.element. - If the element contains annotations, the Interaction and Drag constraints are applied to the first annotation.
Refer to the following example for a practical implementation: Sample
Conclusion
We hope you enjoyed learning how to Add Annotation Constraints in Angular Diagram.
You can refer to our Angular Diagram feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our Angular 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!