Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update types to accept SVGElement | HTMLElement in the constructor #2

Open
pshihn opened this issue Dec 7, 2019 · 0 comments
Open
Assignees

Comments

@pshihn
Copy link

pshihn commented Dec 7, 2019

I have been using this lib with SVGElements and it works great, but I always need to cast the element to any because constructor takes in HTMLElement.

Bonus feature: Also perform getScreenCTM inverse calculation when SVG, to create clientX, clientY in SVG viewport's coordinate system. When using scaled SVGs, I often do the following:

const point = svg.createSVGPoint();
point.x = changed[0].clientX;
point.y = changed[0].clientY;
const coords = point.matrixTransform(svg.getScreenCTM().inverse());
@pshihn pshihn changed the title Update types to accept SVGGElement | HTMLElement in the constructor Update types to accept SVGElement | HTMLElement in the constructor Dec 7, 2019
@jakearchibald jakearchibald self-assigned this Mar 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants