// components/useMapContextMenu.js import { toast } from "react-toastify"; import { zoomIn, zoomOut, centerHere } from "../utils/zoomAndCenterUtils"; // components/useMapContextMenu.js const addItemsToMapContextMenu = (map, menuItemAdded, setMenuItemAdded, openPopupWithCoordinates) => { if (!menuItemAdded && map && map.contextmenu) { map.contextmenu.addItem({ text: "Koordinaten anzeigen", icon: "img/not_listed_location.png", callback: openPopupWithCoordinates, // Aufruf des Popup-Callbacks }); map.contextmenu.addItem({ separator: true }); map.contextmenu.addItem({ text: "Reinzoomen", icon: "img/zoom_in.png", callback: (e) => { map.setZoom(map.getZoom() + 1); }, }); map.contextmenu.addItem({ text: "Rauszoomen", icon: "img/zoom_out.png", callback: () => { map.setZoom(map.getZoom() - 1); }, }); map.contextmenu.addItem({ text: "Hier zentrieren", icon: "img/center_focus.png", callback: (e) => { map.panTo(e.latlng); }, }); setMenuItemAdded(true); } }; export default addItemsToMapContextMenu;