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

Look into mouseEvent offsetX and offsetY #8237

Open
asturur opened this issue Sep 2, 2022 · 2 comments
Open

Look into mouseEvent offsetX and offsetY #8237

asturur opened this issue Sep 2, 2022 · 2 comments
Assignees
Labels

Comments

@asturur
Copy link
Member

asturur commented Sep 2, 2022

Mouse event offsetX and offsetY are now standard.
Using those should help remove a bunch of code related to our calcOffset logic and getElementOffset code that have custom logic to inspect the dom and figure out from page coordinates to canvas coordinates which is the correct translation.

https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent

@asturur asturur self-assigned this Sep 2, 2022
@asturur asturur added the task label Sep 2, 2022
@ShaMan123
Copy link
Contributor

ShaMan123 commented Sep 5, 2022

MouseEvent#offsetX/Y seems perfect. But TouchEvent doesn't have those props unfortunately.
Why don't we use getBoundingClientRect? Because of jsdom?

@asturur
Copy link
Member Author

asturur commented Sep 19, 2022

getBoundingClientRect is considered slow where possible we want to get rid of the necessity to call calcOffset is just an extra headache. Maybe touch events have something similar?
If it will optimize mouse only, still better than nothing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants