-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Interaction calls getBoundingClientRect on mousemove events #854
Comments
Here's a way to approach this: Leaflet/Leaflet@5f85e12 — cache the value on map mouseenter (and assume the position of the map doesn't change while you're interacting with the map), then use the cached value. Not sure why it didn't make much difference in my case though: Leaflet/Leaflet#2335 (comment) — needs reevaluation. Maybe I didn't see difference because I tested on barebones pages without a lot of elements. |
Just putting a quick update here: I did try caching the offsets on More info here: #1598 (comment) @jfirebaugh and I chatted and we both agree that any minor performance bump this trick might get us is not worth the complexity of introducing a cache, and we can't think of a way to avoid calling e.g. offset adjustment in the middle of a Closing this issue as "wontfix" for now.. |
getBoundingClientRect
triggers reflows because it requires style recalculation. It's best not to call this function on fast-firing event handlers.The text was updated successfully, but these errors were encountered: