// /Volumes/Data/Code/FHGR/Frontend/js/map.js // Add the createMarker function to the window object window.createMarker = function(lngLat, content = {}) { const marker = new maplibregl.Marker({ color: '#3887be', draggable: true }) .setLngLat(lngLat) .addTo(map); // Create popup with marker content const popup = new maplibregl.Popup({ offset: 25 }) .setHTML(`${content.title || 'Untitled'}`); marker.setPopup(popup); // When the marker is clicked, open the editor marker.getElement().addEventListener('click', () => { openMarkerEditor(marker); }); // Add marker to current journey const markerData = { id: Date.now(), lngLat: lngLat.toArray(), content: content }; // Add marker to current journey currentJourney.markers.push(marker); updateJourneyPath(); // Add marker to the markers list const markersContainer = document.getElementById('markers-container'); const markerElement = document.createElement('div'); markerElement.className = 'marker-item'; markerElement.innerHTML = `