We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Rotate Change in Diagram Component

Can i Snap the rotation for the rotateChange event closest to 90 degree?


3 Replies 1 reply marked as answer

BM Balasubramanian Manikandan Syncfusion Team October 27, 2022 08:24 AM

Hi Andrew,


Yes, you can snap the  rotation for the rotateChange event closest to 90 degree, by applying snapAngle in the snapSettings. Please find the code example and sample below.


Code Snippet :

 

import {  Snapping,  Inject } from '@syncfusion/ej2-react-diagrams';

 

DiagramComponent.Inject(Snapping);

 

    snapSettings={{

                snapAngle: 90,

              }}

 


Sample:

https://stackblitz.com/edit/react-zappwy?file=index.js



Regards,

Balasubramanian M


Marked as answer

AN Andrew replied to Balasubramanian Manikandan October 30, 2022 09:24 AM

thank u so much, I appreciate ur help, I tried to use the args from the rotateChange function and then setting the angle in the diagram instance and it actually worked well


code snippet:

rotateChange={(args)=>{
if(args.state === 'Completed'){
diagramInstance.getObject(args.source.nodes.map(node=>(
node.rotateAngle = Math.round(args.newValue.rotateAngle/90)*90
)))
}}}





BM Balasubramanian Manikandan Syncfusion Team November 1, 2022 12:38 AM

Hi Andrew,


We are happy to hear that your problem has been resolved.


Thanks,

Balasubramanian M


Loader.
Live Chat Icon For mobile
Up arrow icon