How to trasnlate from Dimensions screen width to svg coordinates
See original GitHub issueI want to do viewBox
using the coordinates I set and accordingly determined for the same ratio of x
and y
to get the coordinates.
I can do this easily on Dom. How can I do this in my `react-native 'application using this package.
let point = svg.createSVGPoint();
point.x = e.clientX;
point.y = e.clientY;
let CTM = svg.getScreenCTM().inverse();
point = point.matrixTransform(CTM);
Issue Analytics
- State:
- Created 4 years ago
- Comments:26
Top Results From Across the Web
How to Translate from DOM to SVG Coordinates and Back Again
Mix DOM and vector interactions in SVG, translating from SVG to DOM coordinates and back, and translating to transformed SVG coordinates.
Read more >How to trasnlate from Dimensions screen width to svg ... - GitHub
I want to do viewBox using the coordinates I set and accordingly determined for the same ratio of x and y to get...
Read more >How to Translate from DOM to SVG Coordinates and Back ...
The getBoundingClientRect() returns the position as size of the item. With properties- x,y, Width, Height, Left, Right, Top, Bottom.
Read more >Coordinate Systems, Transformations and Units — SVG 2
This process converts the min-x, min-y, width and height values of a viewBox attribute, the position and size of the element on which...
Read more >Can not translate screen x,y coordinates to svg coordinates
I have read that point.matrixTransform(svgRoot.getScreenCTM().inverse()); should do the trick and translate screen coordinates to SVG ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This pattern seems to perform quite alright:
To make it compatible with the web (current version has flickering when the slider circle is under the mouse) you need to change the move handler to use pageX and pageY instead of locationX and locationY: