I am trying to convert dom coordiante I get from the ontouch
event( clientX
and clientY
more specifically) however I don't understand how I can do that.
I looked up at this example I found: https://codepen.io/ehsanjso/pen/xNZgPE?editors=1010 and I didn't understood any of it.
If the DOM and the SVG have the same dimensions, the coordinates in pixels and percent are the same. If one is bigger/smaller than the other the coordinates are the same in percent and different in pixels. Example for calculating the X dimension:
Formula: target_width * (point / width)
I hope this helps to understand the basics, explaining the entire example you provided is a bit out of scope
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.