{"action":"created","issue":{"url":"https://api.github.com/repos/Leaflet/Leaflet/issues/3249","labels_url":"https://api.github.com/repos/Leaflet/Leaflet/issues/3249/labels{/name}","comments_url":"https://api.github.com/repos/Leaflet/Leaflet/issues/3249/comments","events_url":"https://api.github.com/repos/Leaflet/Leaflet/issues/3249/events","html_url":"https://github.com/Leaflet/Leaflet/issues/3249","id":58765841,"number":3249,"title":"Glitchy behavior when animating fitBounds multiple times","user":{"login":"uniphil","id":205128,"avatar_url":"https://avatars.githubusercontent.com/u/205128?v=3","gravatar_id":"","url":"https://api.github.com/users/uniphil","html_url":"https://github.com/uniphil","followers_url":"https://api.github.com/users/uniphil/followers","following_url":"https://api.github.com/users/uniphil/following{/other_user}","gists_url":"https://api.github.com/users/uniphil/gists{/gist_id}","starred_url":"https://api.github.com/users/uniphil/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/uniphil/subscriptions","organizations_url":"https://api.github.com/users/uniphil/orgs","repos_url":"https://api.github.com/users/uniphil/repos","events_url":"https://api.github.com/users/uniphil/events{/privacy}","received_events_url":"https://api.github.com/users/uniphil/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-02-24T16:45:17Z","updated_at":"2015-02-24T19:28:33Z","closed_at":null,"body":"Demo: [0.7.3](http://codepen.io/uniphil/pen/zxjprZ), [master](http://codepen.io/uniphil/pen/NPMBqM).\r\n\r\nTriggering code:\r\n\r\n```javascript\r\nmap.fitBounds([[-20, -20], [20, 20]]);\r\nmap.fitBounds([[-10, -10], [10, 10]]);\r\n```\r\n\r\n**Expected behaviour**: final state of the map reflects the last call to `fitBounds`.\r\n\r\n**Observed behaviour**: final state of the map might reflect either of the `fitBounds` calls, depending on the initial map state.\r\n\r\nThe effect is reproducible as long as the second `fitBounds` is called before the first has finished animating, eg:\r\n\r\n```javascript\r\nmap.fitBounds([[-20, -20], [20, 20]]);\r\nsetTimeout(function() {\r\n  map.fitBounds([[-10, -10], [10, 10]]);\r\n}, 200);\r\n```\r\nor a user clicking two buttons in quick succession will also show the effect.\r\n\r\nDisabling animation on the `fitBounds` calls prevents the issue, but... the zooms are so pretty! :)\r\n\r\nI don't have a simple testcase for it, but in my project, two quick `fitBounds` calls can also leave the map in weirder states (zoomed out very far) that don't reflect any of the `fitBounds` calls.\r\n\r\n**Edit**: the issue may not affect other animated view changes. tested and working as expected:\r\n * [`setView`](http://codepen.io/uniphil/pen/dPejVv)\r\n * [`panTo`](http://codepen.io/uniphil/pen/VYxBpp)\r\n"},"comment":{"url":"https://api.github.com/repos/Leaflet/Leaflet/issues/comments/75827312","html_url":"https://github.com/Leaflet/Leaflet/issues/3249#issuecomment-75827312","issue_url":"https://api.github.com/repos/Leaflet/Leaflet/issues/3249","id":75827312,"user":{"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},"created_at":"2015-02-24T19:28:33Z","updated_at":"2015-02-24T19:28:33Z","body":"I'm just wondering why it's specifically limited to `fitBounds` when it just calls `setView` under the hood..."}}