Open youssefajaamoum opened 2 years ago
Can you provide the full code for what you're trying to do? How are you calling panTo or flyTo? Are you just passing in the newLatLng? You might need to create a second leaflet.LatLng object from the same lat/lng cause Leaflet is weird about mutating objects you would think would be mutable.
Hi, I am trying to update the position of the marker on the map, the position of the marker has been updated but I cannot fly to the new position of the marker.
@ViewChild(LeafletDirective, { static: false }) map: LeafletDirective;
updateMarker(lat: number, lng: number) {
var newLatLng = new leaflet.LatLng(lat, lng);
// the marker moved to new lat, lng this.markers[0].marker.setLatLng(newLatLng);
// can’t use this.map.panTo() or flyTo()
}