markerUtils in poiUitls umbenannt
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
// /utils/markerUtils.js
|
||||
import circleIcon from "../components/gisPolylines/icons/CircleIcon";
|
||||
import { saveLineData, redrawPolyline } from "./mapUtils";
|
||||
// /utils/poiUtils.js
|
||||
import circleIcon from "../components/gisPolylines/icons/CircleIcon.js";
|
||||
import { saveLineData, redrawPolyline } from "./mapUtils.js";
|
||||
import L from "leaflet";
|
||||
import "leaflet.smooth_marker_bouncing";
|
||||
import { toast } from "react-toastify";
|
||||
import * as config from "../config/config.js";
|
||||
|
||||
export const insertNewMarker = (closestPoints, newPoint, lineData, map) => {
|
||||
export const insertNewPOI = (closestPoints, newPoint, lineData, map) => {
|
||||
const newMarker = L.marker(newPoint, {
|
||||
icon: circleIcon,
|
||||
draggable: true,
|
||||
@@ -32,7 +32,7 @@ export const insertNewMarker = (closestPoints, newPoint, lineData, map) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const removeMarker = (marker, lineData, currentZoom, currentCenter) => {
|
||||
export const removePOI = (marker, lineData, currentZoom, currentCenter) => {
|
||||
// Save zoom and center to localStorage
|
||||
//localStorage.setItem("mapZoom", currentZoom);
|
||||
//localStorage.setItem("mapCenter", JSON.stringify(currentCenter));
|
||||
@@ -2,7 +2,7 @@
|
||||
import { findClosestPoints } from "./geometryUtils";
|
||||
import handlePoiSelect from "./handlePoiSelect";
|
||||
import { updateLocationInDatabase } from "../services/apiService";
|
||||
import { handleEditPoi, insertNewMarker, removeMarker } from "./markerUtils";
|
||||
import { handleEditPoi, insertNewPOI, removePOI } from "./poiUtils";
|
||||
import { parsePoint } from "./geometryUtils";
|
||||
import circleIcon from "../components/gisPolylines/icons/CircleIcon";
|
||||
import startIcon from "../components/gisPolylines/icons/StartIcon";
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
import { findClosestPoints } from "./geometryUtils";
|
||||
import handlePoiSelect from "./handlePoiSelect";
|
||||
import { updateLocationInDatabase } from "../services/apiService";
|
||||
import { handleEditPoi, insertNewMarker, removeMarker } from "./markerUtils";
|
||||
import { handleEditPoi, insertNewPOI, removePOI } from "./poiUtils";
|
||||
import { parsePoint } from "./geometryUtils";
|
||||
import circleIcon from "../components/gisPolylines/icons/CircleIcon";
|
||||
import startIcon from "../components/gisPolylines/icons/StartIcon";
|
||||
@@ -127,7 +127,7 @@ export const setupPolylines = (map, linePositions, lineColors, tooltipContents,
|
||||
const newCoordinates = [...lineData.coordinates];
|
||||
newCoordinates[index] = [newCoords.lat, newCoords.lng];
|
||||
|
||||
removeMarker(marker, lineData, currentZoom, currentCenter);
|
||||
removePOI(marker, lineData, currentZoom, currentCenter);
|
||||
polylines[lineIndex].remove();
|
||||
lineData.coordinates = newCoordinates;
|
||||
},
|
||||
@@ -157,7 +157,7 @@ export const setupPolylines = (map, linePositions, lineColors, tooltipContents,
|
||||
}
|
||||
const newPoint = e.latlng;
|
||||
const closestPoints = findClosestPoints(lineData.coordinates, newPoint, map);
|
||||
insertNewMarker(closestPoints, newPoint, lineData, map);
|
||||
insertNewPOI(closestPoints, newPoint, lineData, map);
|
||||
redrawPolyline(lineData, lineColors, tooltipContents, map);
|
||||
window.location.reload();
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user