From 1416481ba90b6d94c5c0bee4440af3bee6ad4220 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonia=20P=C3=A9rez-Cerezo?= Date: Mon, 10 Mar 2025 19:21:55 +0100 Subject: [PATCH] colorize the start and end icons --- frontend/common/map.js | 9 ++++++++- frontend/common/styles.css | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/frontend/common/map.js b/frontend/common/map.js index dc7ad23..052a0d2 100644 --- a/frontend/common/map.js +++ b/frontend/common/map.js @@ -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(); }); diff --git a/frontend/common/styles.css b/frontend/common/styles.css index d756f67..150beda 100644 --- a/frontend/common/styles.css +++ b/frontend/common/styles.css @@ -19,3 +19,5 @@ body { display: inline-block; margin-right: 0.7em; } +img.red { filter: hue-rotate(120deg); } +img.green { filter: hue-rotate(-120deg); }