An open API service indexing awesome lists of open source software.

https://github.com/laszlokorte/svg-viewbox-trans

This is an experiment to transform coordinates from the viewport space (`clientX`, `clientY`) into the local SVG without using `svg.getScreenCTM()`.
https://github.com/laszlokorte/svg-viewbox-trans

Last synced: about 2 months ago
JSON representation

This is an experiment to transform coordinates from the viewport space (`clientX`, `clientY`) into the local SVG without using `svg.getScreenCTM()`.

Awesome Lists containing this project

README

        

![Screenshot of the app](preview.png)

[Live Demo](https://static.laszlokorte.de/svg-viewbox-trans/)

# Manual SVG ViewBox calculation

This is an experiment to transform coordinates from the viewport space (`clientX`, `clientY`) into the local SVG without using `svg.getScreenCTM()`. The reason for not using `getScreenCTM()` is to be able to do the calculations without updating the SVG DOM element.

Configure the SVG element and ViewBox size and alignment as you like and then click inside the SVG. The red dot shoult be placed correctly at the click position.