How to Prevent Node Rotation in Javascript Diagram?
In the Syncfusion® JavaScript Diagram we have the flexibility to enable or disable specific behaviors of nodes through the use of NodeConstraints.
To prevent the rotation of a node in Diagram, we can use the Rotate NodeConstraint and disable it using the Bitwise ‘&~’ (XOR) operator
// Set the constraints for the node as Rotate and disable it
constraints: ej.diagrams.NodeConstraints.Default & ~ej.diagrams.NodeConstraints.Rotate
Below is a code example demonstrating how to prevent rotation in node
var node = [
{
offsetX: 250,
offsetY: 250,
width: 100,
height: 100,
// Disable the Rotate NodeConstraint
constraints: ej.diagrams.NodeConstraints.Default & ~ej.diagrams.NodeConstraints.Rotate,
},
];
// Initialize Diagram component
var diagram = new ej.diagrams.Diagram(
{
width: '100%',
height: '600px',
nodes: node,
},
'#element'
);
Sample : Click here for sample
Conclusion
I hope you enjoyed learning how to prevent node rotation in the Javascript Diagram.
You can refer to our JavaScript Diagram feature tour page to know 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, Direct-Trac, or feedback portal. We are always happy to assist you!