{"action":"created","issue":{"url":"https://api.github.com/repos/Leaflet/Leaflet/issues/4260","repository_url":"https://api.github.com/repos/Leaflet/Leaflet","labels_url":"https://api.github.com/repos/Leaflet/Leaflet/issues/4260/labels{/name}","comments_url":"https://api.github.com/repos/Leaflet/Leaflet/issues/4260/comments","events_url":"https://api.github.com/repos/Leaflet/Leaflet/issues/4260/events","html_url":"https://github.com/Leaflet/Leaflet/issues/4260","id":134526769,"number":4260,"title":"panTo() rubberbands around the Earth ","user":{"login":"delner","id":3237131,"avatar_url":"https://avatars.githubusercontent.com/u/3237131?v=3","gravatar_id":"","url":"https://api.github.com/users/delner","html_url":"https://github.com/delner","followers_url":"https://api.github.com/users/delner/followers","following_url":"https://api.github.com/users/delner/following{/other_user}","gists_url":"https://api.github.com/users/delner/gists{/gist_id}","starred_url":"https://api.github.com/users/delner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/delner/subscriptions","organizations_url":"https://api.github.com/users/delner/orgs","repos_url":"https://api.github.com/users/delner/repos","events_url":"https://api.github.com/users/delner/events{/privacy}","received_events_url":"https://api.github.com/users/delner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-18T09:29:40Z","updated_at":"2016-02-18T09:50:12Z","closed_at":null,"body":"I've been developing a web app using Leaflet where the user locates a city by panning to it, then double clicking to place a marker. After the marker is placed, I call the `panTo()` function to pan the map to the location of the city.\r\n\r\nThrough the course of this interaction, the user gets a weird experience if they pan around the entire map before `panTo()` is called: \r\n\r\n1. It will rubberband the map around the entire world back to the equivalent place where they started.\r\n2. Any markers on the location in question will 'disappear' (presumably still on a neighboring copy to the center map that Leaflet pans to.)\r\n\r\nHere's a video of the interaction I'm seeing. In this case, I'm starting at Los Angeles, scrolling westward around the Earth back to Los Angeles, placing a map marker (the circle that appears before the rubberband), and then calling `panTo` with the coordinates of Los Angeles. When I call `panTo` it rubberbands eastward around the world.\r\n\r\n![panTo oddity](http://i.imgur.com/KhDKwqQ.gif)\r\n\r\nI'm not sure whether it qualifies as a bug, but it definitely doesn't feel like great behavior, especially because it \"wipes out\" map markers in the process. Thoughts?"},"comment":{"url":"https://api.github.com/repos/Leaflet/Leaflet/issues/comments/185632126","html_url":"https://github.com/Leaflet/Leaflet/issues/4260#issuecomment-185632126","issue_url":"https://api.github.com/repos/Leaflet/Leaflet/issues/4260","id":185632126,"user":{"login":"IvanSanchez","id":1125786,"avatar_url":"https://avatars.githubusercontent.com/u/1125786?v=3","gravatar_id":"","url":"https://api.github.com/users/IvanSanchez","html_url":"https://github.com/IvanSanchez","followers_url":"https://api.github.com/users/IvanSanchez/followers","following_url":"https://api.github.com/users/IvanSanchez/following{/other_user}","gists_url":"https://api.github.com/users/IvanSanchez/gists{/gist_id}","starred_url":"https://api.github.com/users/IvanSanchez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IvanSanchez/subscriptions","organizations_url":"https://api.github.com/users/IvanSanchez/orgs","repos_url":"https://api.github.com/users/IvanSanchez/repos","events_url":"https://api.github.com/users/IvanSanchez/events{/privacy}","received_events_url":"https://api.github.com/users/IvanSanchez/received_events","type":"User","site_admin":false},"created_at":"2016-02-18T09:50:12Z","updated_at":"2016-02-18T09:50:12Z","body":"I've made a [playground](http://playground-leaflet.rhcloud.com/kim/edit?html,console,output) showing this bug:\r\n\r\n```js\r\n\tvar mad = [40.40, -3.7];\r\n\r\n    var map = new L.Map('map', {center: mad, zoom: 2, worldCopyJump: true});\r\n\r\n    var positron = L.tileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {\r\n        attribution: '&copy; <a href=\"http://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors, &copy; <a href=\"http://cartodb.com/attributions\">CartoDB</a>'\r\n    }).addTo(map);\r\n\r\n    var marker = new L.Marker(mad);\r\n    map.addLayer(marker);\r\n\r\n    for(var i=1; i<=4; i++) {\r\n\t\tsetTimeout((function(a){\r\n\t\t\treturn function(){\r\n\t\t\t\tconsole.log('panning to', [40.40, -3.7 + (90 * a)]);\r\n\t\t\t\tmap.panTo( [40.40, -3.7 + (90 * a)]);\r\n            }\r\n\t\t})(i), 1000 * i);\r\n    }\r\n\r\n\tsetTimeout(function() {\r\n\t\tmap.panTo(mad);\r\n\t}, 5000);\r\n```"}}