Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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 20 hours 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.