-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Cache container position for DomUtil.getMousePosition #2335
Comments
cc @danzel |
Weird thing about that is that |
Could you share an example this is easy to reproduce on? |
Are we manipulating the DOM, then calling those functions? |
It's easy to reproduce with the |
Profiler says that most of the time during mouse interactions is spent on getting the current mouse position relative to map container, and specifically container position (
container.getBoundingClientRect()
andcontainer.clientLeft/Top
).We could cache it under certain conditions to get rid of the slowdown, but this is somewhat tricky because we need to avoid out-of-sync situations. One way is to put a
window.onscroll
handler when wemouseover
the container, reset cache on scroll and use cached otherwise. But this may have side effects so needs to be tested thoroughly.The text was updated successfully, but these errors were encountered: