Get the absolute position of a node

Hi,

I need to get the absolute position of a node of a diagram in the web page. I easily get the offsetX and offsetY of the node. And that's fine as long as I don't use the zoom in, zoom out and Pan methods. Because offSet is a specific position inside the diagram.

Do you have any idea how to get it? Maybe the absolute position of the center of the diagram in the web page ?


Regards,

Laurent


3 Replies

SS Sivakumar Sekar Syncfusion Team December 30, 2021 01:51 PM UTC

Hi Laurent, 

We have added the sample link to demonstrate how to get the position of the node after zooming in, zooming out, and panning. By using the getElementById method, we can able to find the element, after finding the element using the getBoundingClientRect method we can able to find the element position after zooming and panning the diagram. 

node = document.getElementById( (NodeID); 
console.log(node.getBoundingClientRect()); 
 




Regards, 
Sivakumar 





LA Laurent December 30, 2021 05:36 PM UTC

Perfect!

Thanks a lot,

regards,

Laurent



SS Sivakumar Sekar Syncfusion Team December 31, 2021 12:40 PM UTC

Hi Laurent, 
 
Thanks for your update 
 
Regards,  
Sivakumar  



Loader.
Up arrow icon