feat: marker entfernen und polylines aktualisieren

This commit is contained in:
ISA
2024-06-28 10:07:54 +02:00
parent 98723c9ca4
commit f7cb225aab

View File

@@ -2382,7 +2382,15 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
contextmenuItems: [ contextmenuItems: [
{ {
text: "Marker entfernen", text: "Marker entfernen",
callback: () => removeMarker(marker, lineData), callback: () => {
const newCoords = marker.getLatLng();
const newCoordinates = [...lineData.coordinates];
newCoordinates[index] = [newCoords.lat, newCoords.lng];
removeMarker(marker, lineData);
newPolylines[lineIndex].remove();
lineData.coordinates = newCoordinates;
},
}, },
], ],
}); });
@@ -2416,7 +2424,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
polyline.on("mouseover", (e) => { polyline.on("mouseover", (e) => {
// Optional: Visualisiere, dass die Linie interaktiv ist // Optional: Visualisiere, dass die Linie interaktiv ist
polyline.setStyle({ color: "blue" }); polyline.setStyle({ color: "blue", weight: 10 });
}); });
polyline.on("mouseout", (e) => { polyline.on("mouseout", (e) => {