diff --git a/app/javascript/controllers/maps_controller.js b/app/javascript/controllers/maps_controller.js index 99b72664..025f9655 100644 --- a/app/javascript/controllers/maps_controller.js +++ b/app/javascript/controllers/maps_controller.js @@ -166,14 +166,7 @@ export default class extends Controller { // Add the new point to the markers array this.markers.push(newPoint); - // Create a new marker for the point - const markerOptions = { - ...this.userSettings, // Pass any relevant settings - id: newPoint[6], // Assuming index 6 contains the point ID - timestamp: newPoint[4] // Assuming index 2 contains the timestamp - }; - - const newMarker = this.createMarker(newPoint, markerOptions); + const newMarker = L.marker([newPoint[0], newPoint[1]]) this.markersArray.push(newMarker); // Update the markers layer @@ -195,7 +188,7 @@ export default class extends Controller { ); // Pan map to new location - this.map.setView([newPoint[0], newPoint[1]], 14); + this.map.setView([newPoint[0], newPoint[1]], 16); // Update fog of war if enabled if (this.map.hasLayer(this.fogOverlay)) { @@ -210,48 +203,6 @@ export default class extends Controller { }); this.addLastMarker(this.map, this.markers); - - this.openNewMarkerPopup(newPoint); - } - - openNewMarkerPopup(point) { - // Create a temporary marker just for displaying the timestamp - const timestamp = formatDate(point[4], this.timezone); - - const tempMarker = L.marker([point[0], point[1]]); - const popupContent = ` -
-

${timestamp}

-
- `; - - tempMarker - .bindPopup(popupContent) - .addTo(this.map) - .openPopup(); - - // Remove the temporary marker after 5 seconds - setTimeout(() => { - this.map.removeLayer(tempMarker); - }, 300); - } - - - createMarker(point, options) { - const marker = L.marker([point[0], point[1]]); - - // Add popup content based on point data - const popupContent = ` -
-

Time: ${new Date(point[2]).toLocaleString()}

- ${point[3] ? `

Address: ${point[3]}

` : ''} - ${point[7] ? `

Country: ${point[7]}

` : ''} - Delete -
- `; - - marker.bindPopup(popupContent); - return marker; } async setupScratchLayer(countryCodesMap) { @@ -293,7 +244,6 @@ export default class extends Controller { } } - getVisitedCountries(countryCodesMap) { if (!this.markers) return [];