diff --git a/js/map.js b/js/map.js
index f33422f..270ea9d 100644
--- a/js/map.js
+++ b/js/map.js
@@ -1,19 +1,14 @@
// /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);
+ const marker = L.marker(lngLat, {
+ draggable: true,
+ title: content.title || 'Untitled'
+ }).addTo(map);
// Create popup with marker content
- const popup = new maplibregl.Popup({ offset: 25 })
- .setHTML(`${content.title || 'Untitled'}${content.description ? `
${content.description}` : ''}`);
+ marker.bindPopup(`${content.title || 'Untitled'}${content.description ? `
${content.description}` : ''}`);
- marker.setPopup(popup);
-
// When the marker is clicked, open the editor
marker.on('click', () => {
openMarkerEditor(marker);
@@ -22,7 +17,7 @@ window.createMarker = function(lngLat, content = {}) {
// Add marker to current journey
const markerData = {
id: Date.now(),
- lngLat: lngLat.toArray(),
+ lngLat: [lngLat.lat, lngLat.lng], // Leaflet uses [lat, lng]
content: content,
coordinates: [lngLat.lat, lngLat.lng]
};
@@ -38,13 +33,13 @@ window.createMarker = function(lngLat, content = {}) {
markerElement.className = 'marker-item';
markerElement.innerHTML = `