On a simple Leaflet map, with leafleat-routing-machine, if two routes pass by the same place, only the top one is visible. I can live with this if I can choose which route is on top, (for example by clicking on it). So, given a route, how can I put it on top?
Here is a simple code sample I would like to improve:
map = L.map("map");
L.tileLayer("https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}.png", {
attribution: "© <a href=\"https://www.openstreetmap.org/copyright\">OpenStreetMap</a> contributors"
}).addTo(map);
var route1 = L.Routing.control({
waypoints: [
L.latLng(-22.985308, -43.204845),
L.latLng(-22.983449, -43.202773),
],
}).addTo(map);
var route2 = L.Routing.control({
waypoints: [
L.latLng(-22.983449, -43.204845),
L.latLng(-22.984708, -43.202430),
],
}).addTo(map);
// Now I would love this to exist:
function bringOnTop() {
...
}
bringOnTop(route1);
bringOnTop(route2);