{"action":"created","issue":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/854","labels_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/854/labels{/name}","comments_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/854/comments","events_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/854/events","html_url":"https://github.com/mapbox/mapbox-gl-js/issues/854","id":50568893,"number":854,"title":"Interaction calls getBoundingClientRect on mousemove events","user":{"login":"tmcw","id":32314,"avatar_url":"https://avatars.githubusercontent.com/u/32314?v=3","gravatar_id":"","url":"https://api.github.com/users/tmcw","html_url":"https://github.com/tmcw","followers_url":"https://api.github.com/users/tmcw/followers","following_url":"https://api.github.com/users/tmcw/following{/other_user}","gists_url":"https://api.github.com/users/tmcw/gists{/gist_id}","starred_url":"https://api.github.com/users/tmcw/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tmcw/subscriptions","organizations_url":"https://api.github.com/users/tmcw/orgs","repos_url":"https://api.github.com/users/tmcw/repos","events_url":"https://api.github.com/users/tmcw/events{/privacy}","received_events_url":"https://api.github.com/users/tmcw/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"closed","locked":false,"assignee":{"login":"mourner","id":25395,"avatar_url":"https://avatars.githubusercontent.com/u/25395?v=3","gravatar_id":"","url":"https://api.github.com/users/mourner","html_url":"https://github.com/mourner","followers_url":"https://api.github.com/users/mourner/followers","following_url":"https://api.github.com/users/mourner/following{/other_user}","gists_url":"https://api.github.com/users/mourner/gists{/gist_id}","starred_url":"https://api.github.com/users/mourner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mourner/subscriptions","organizations_url":"https://api.github.com/users/mourner/orgs","repos_url":"https://api.github.com/users/mourner/repos","events_url":"https://api.github.com/users/mourner/events{/privacy}","received_events_url":"https://api.github.com/users/mourner/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2014-12-01T20:13:55Z","updated_at":"2015-11-20T06:32:55Z","closed_at":"2015-11-20T06:32:55Z","body":"`getBoundingClientRect` [triggers reflows](http://gent.ilcore.com/2011/03/how-not-to-trigger-layout-in-webkit.html) because it requires style recalculation. It's best not to call this function on fast-firing event handlers."},"comment":{"url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/comments/158294969","html_url":"https://github.com/mapbox/mapbox-gl-js/issues/854#issuecomment-158294969","issue_url":"https://api.github.com/repos/mapbox/mapbox-gl-js/issues/854","id":158294969,"user":{"login":"bhousel","id":38784,"avatar_url":"https://avatars.githubusercontent.com/u/38784?v=3","gravatar_id":"","url":"https://api.github.com/users/bhousel","html_url":"https://github.com/bhousel","followers_url":"https://api.github.com/users/bhousel/followers","following_url":"https://api.github.com/users/bhousel/following{/other_user}","gists_url":"https://api.github.com/users/bhousel/gists{/gist_id}","starred_url":"https://api.github.com/users/bhousel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bhousel/subscriptions","organizations_url":"https://api.github.com/users/bhousel/orgs","repos_url":"https://api.github.com/users/bhousel/repos","events_url":"https://api.github.com/users/bhousel/events{/privacy}","received_events_url":"https://api.github.com/users/bhousel/received_events","type":"User","site_admin":false},"created_at":"2015-11-20T06:32:55Z","updated_at":"2015-11-20T06:32:55Z","body":"Just putting a quick update here:  I did try caching the offsets on `mouseenter` of the canvas container, but it caused some issues when there were multiple maps on the same page and they were both trying to reset the cache.\r\n\r\nMore info here:  https://github.com/mapbox/mapbox-gl-js/pull/1598#issuecomment-158270377\r\n\r\n@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 `getBoundingClientRect`.\r\n\r\ne.g. offset adjustment in the middle of a `mousemove`:\r\n![cached offset issue](https://cloud.githubusercontent.com/assets/38784/11293234/263c0e84-8f26-11e5-9799-d9c756fe9027.gif)\r\n\r\nClosing this issue as \"wontfix\" for now.."}}