Fix: redrawPoline.js und POI hinzufgen auf die Karte in Kontextmenü
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
// /utils/markerUtils.js
|
||||
import circleIcon from "../components/CircleIcon";
|
||||
import { saveLineData, redrawPolyline } from "./mapUtils";
|
||||
import { saveLineData } from "./mapUtils";
|
||||
import { redrawPolyline } from "./mapUtils";
|
||||
import L from "leaflet";
|
||||
import { toast } from "react-toastify";
|
||||
|
||||
@@ -9,10 +10,7 @@ export const insertNewMarker = (closestPoints, newPoint, lineData, map) => {
|
||||
icon: circleIcon,
|
||||
draggable: true,
|
||||
}).addTo(map);
|
||||
lineData.coordinates.splice(closestPoints[2], 0, [
|
||||
newPoint.lat,
|
||||
newPoint.lng,
|
||||
]);
|
||||
lineData.coordinates.splice(closestPoints[2], 0, [newPoint.lat, newPoint.lng]);
|
||||
|
||||
// Hier direkt speichern nach Einfügen
|
||||
saveLineData(lineData);
|
||||
@@ -39,9 +37,7 @@ export const removeMarker = (marker, lineData, currentZoom, currentCenter) => {
|
||||
//localStorage.setItem("mapCenter", JSON.stringify(currentCenter));
|
||||
|
||||
// Find the index of the coordinate that matches the marker's position
|
||||
const index = lineData.coordinates.findIndex((coord) =>
|
||||
L.latLng(coord[0], coord[1]).equals(marker.getLatLng())
|
||||
);
|
||||
const index = lineData.coordinates.findIndex((coord) => L.latLng(coord[0], coord[1]).equals(marker.getLatLng()));
|
||||
|
||||
if (index !== -1) {
|
||||
// Remove the coordinate from the line data
|
||||
|
||||
Reference in New Issue
Block a user