how to pass getLatLng() on runSimulation correctly, I've tried many ways, but not getting what I want. It's working when I'm not dragging my marker, but when I drag them and run Simulation, it's giving me errors
function runSimulation() {
console.log("starting simulation");
initializeUserMarker(routes[0].marker);
const seconds = 60;
const numSteps = 20;
let pointsObj = {
i: 0,
};
setInterval(() => step(pointsObj), (seconds / numSteps) * 1000);
}
--
function initializeUserMarker(marker) {
const UserIcon = L.Icon.extend({
options: {
iconSize: [38, 95],
shadowSize: [0, 0],
iconAnchor: [22, 94],
shadowAnchor: [4, 62],
popupAnchor: [-3, -76],
},
});
// user icon
var userIcon = new UserIcon({
iconUrl: "./assets/images/sport-car.png",
shadowUrl:
"http://leafletjs.com/examples/custom-icons/leaf-shadow.png",
});
// add icon to map
userMarker = {
"id": atomicCounter,
"marker": L.marker(marker.getLatLng(), {icon: userIcon}).addTo(map)
};
}
