diff --git a/js/main.js b/js/main.js index 740144e..ef813b6 100644 --- a/js/main.js +++ b/js/main.js @@ -9,6 +9,19 @@ document.addEventListener('DOMContentLoaded', function() { path: null }; + // Add journey path layer + const journeyPath = L.polyline([], {color: '#3887be', weight: 4}); + map.addLayer(journeyPath); + + function updateJourneyPath() { + const coordinates = window.currentJourney.markers.map(marker => [ + marker.getLatLng().lat, + marker.getLatLng().lng + ]); + + journeyPath.setLatLngs(coordinates); + } + // Function to prepare and save the journey function prepareAndSaveJourney() { const journeyData = {