colorize the start and end icons
This commit is contained in:
parent
2fee843c52
commit
1416481ba9
2 changed files with 10 additions and 1 deletions
|
@ -73,6 +73,13 @@ let geojson;
|
|||
let editlayer;
|
||||
|
||||
async function updateBrouter () {
|
||||
if (markers.length > 0) {
|
||||
for (i=1; i< markers.length-1; i++) {
|
||||
markers[i]._icon.classList.remove("red");
|
||||
}
|
||||
markers[markers.length-1]._icon.classList.add("red");
|
||||
markers[0]._icon.classList.add("green");
|
||||
}
|
||||
if (markers.length < 2) {
|
||||
if (geojson != undefined) {
|
||||
map.removeLayer(geojson);
|
||||
|
@ -110,7 +117,6 @@ map.on('click', function(e) {
|
|||
// }
|
||||
marker = new L.marker(e.latlng, {draggable: true}) ;
|
||||
markers.push(marker);
|
||||
updateBrouter();
|
||||
marker.on("click", function(e) {
|
||||
map.removeLayer(this);
|
||||
markers = markers.filter(item => item != this);
|
||||
|
@ -120,6 +126,7 @@ map.on('click', function(e) {
|
|||
updateBrouter();
|
||||
});
|
||||
marker.addTo(map);
|
||||
updateBrouter();
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -19,3 +19,5 @@ body {
|
|||
display: inline-block;
|
||||
margin-right: 0.7em;
|
||||
}
|
||||
img.red { filter: hue-rotate(120deg); }
|
||||
img.green { filter: hue-rotate(-120deg); }
|
||||
|
|
Loading…
Add table
Reference in a new issue