Articles in this section

How to Trigger Event When Diagram is Read-Only Mode in Angular Diagram

In this article, you can learn how to trigger an event when the diagram is in read-only mode in Angular Diagram.In Syncfusion® Angular Diagram, you can make the diagram read-only while still triggering events like click by disabling the select constraints on nodes and connectors, along with the zoom constraint on the diagram. This effectively prevents interactions such as selection and zooming. The getNodeDefaults method uses NodeConstraints to disable the selection functionality on nodes, while the getConnectorDefaults method uses ConnectorConstraints to disable the selection functionality on connectors. Additionally, the DiagramConstraints disable the zoom functionality in the diagram.

The following code snippet demonstrates how to configure these settings and trigger the click event.

//Disable the Select constraint for nodes
public nodeDefaults(obj: NodeModel): NodeModel {
   obj.constraints = NodeConstraints.Default & ~NodeConstraints.Select;
   return obj;
 }
 //Disable the Select constraint for connectors
 public connectorDefaults(obj: ConnectorModel): void {
   obj.constraints = ConnectorConstraints.Default & ~ConnectorConstraints.Select;
 }
//Disable the Zoom constraint for diagram
 public constraints(): void {
   this.diagram.constraints =
     DiagramConstraints.Default & ~DiagramConstraints.Zoom;
 }
//Define the click event
public click(): void {
   alert('Click Event is triggered');
 } 

Refer to the working sample for additional details and implementation: Click here for sample

Conclusion

We hope you enjoyed learning how to trigger a click event when the diagram is in read-only mode in Angular Diagram.

You can refer to our Angular 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 Angular Diagram example to understand how to create and manipulate data.

For current customers, you can check out our components on the License and Downloads page. If you are new to Syncfusion®, you can try our 30-day free trial to explore 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!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied