Articles in this section

How to Prevent Node Rotation in React Diagram?

In the Syncfusion® React 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 a 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: NodeConstraints.Default & ~NodeConstraints.Rotate,

Below is a code example demonstrating how to prevent rotation in node

import * as React from "react";
import { createRoot } from 'react-dom/client';
import { DiagramComponent, NodeConstraints } from "@syncfusion/ej2-react-diagrams";

let node = [{
       offsetX: 250,
       offsetY: 250,
       width: 100,
       height: 100,
       constraints: NodeConstraints.Default & ~NodeConstraints.Rotate
   }];
// Initialize Diagram component
function App() {
   return (<DiagramComponent id="container" width={'100%'} height={'600px'} 
   // Add node
   nodes={node}/>);
}
const root = createRoot(document.getElementById('diagram'));
root.render(<App />); 

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

Conclusion

We hope you enjoyed about how to Prevent Node Rotation in React Diagram.

You can refer to our React 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 React 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!

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