I use this function on my backbone view when a new GPS coordinate comes in:
onLocationFound: function(position){
// this function runs every time we get a valid GPS fix
// here I have some preparation code, like getting "position"
if(myApp.mapView.hasCenter){
this.map.panTo(position.coords.latlng);
}
},
Then, on another pice of code I run this function:
this.map.on("moveend", function(s){
that.doDrawReports();
});
My Problem is that the moveend
event isn't catching my panTo
operation. How can I catch it?
Could not reproduce your issue sorry:
Test code:
var map = L.map("map").setView([48.86, 2.35], 12);
setInterval(function () {
var currentPos = map.getCenter();
map.panTo([
currentPos.lat,
currentPos.lng + 0.1
])
}, 2000);
map.on("moveend", function () {
console.log(map.getCenter().toString());
});
Even by decreasing the interval down to 50ms, the moveend
listener is still called.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With