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
panTo() ignores worldCopyJump option #4260
Labels
Comments
Have you tried the |
I've made a playground showing this bug: var mad = [40.40, -3.7];
var map = new L.Map('map', {center: mad, zoom: 2, worldCopyJump: true});
var positron = L.tileLayer('http://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png', {
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors, © <a href="http://cartodb.com/attributions">CartoDB</a>'
}).addTo(map);
var marker = new L.Marker(mad);
map.addLayer(marker);
for(var i=1; i<=4; i++) {
setTimeout((function(a){
return function(){
console.log('panning to', [40.40, -3.7 + (90 * a)]);
map.panTo( [40.40, -3.7 + (90 * a)]);
}
})(i), 1000 * i);
}
setTimeout(function() {
map.panTo(mad);
}, 5000); |
IvanSanchez
changed the title
panTo() rubberbands around the Earth
panTo() ignores worldCopyJump option
Feb 18, 2016
Oh, interesting. No I haven't, I'll see if adding the option changes anything. |
Probably dublicate: #2125 |
Yes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.Through the course of this interaction, the user gets a weird experience if they pan around the entire map before
panTo()
is called:Here'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 callpanTo
it rubberbands eastward around the world.I'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?
EDIT:
This is for Leaflet master (1.0.0beta2 + some recent bugfixes)
I was calling
panTo()
with the following:The text was updated successfully, but these errors were encountered: