From f7cb225aabba4ca4723560b5b39b55146042ebdc Mon Sep 17 00:00:00 2001 From: ISA Date: Fri, 28 Jun 2024 10:07:54 +0200 Subject: [PATCH] feat: marker entfernen und polylines aktualisieren --- components/MapComponent.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/components/MapComponent.js b/components/MapComponent.js index 16695c27c..16501840d 100644 --- a/components/MapComponent.js +++ b/components/MapComponent.js @@ -2382,7 +2382,15 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => { contextmenuItems: [ { 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) => { // Optional: Visualisiere, dass die Linie interaktiv ist - polyline.setStyle({ color: "blue" }); + polyline.setStyle({ color: "blue", weight: 10 }); }); polyline.on("mouseout", (e) => {