feat: create useMapContextMenu.js for Separate of Conserns or modularity
This commit is contained in:
@@ -76,6 +76,7 @@ import {
|
||||
} from "../utils/contextMenuUtils.js";
|
||||
import { MAP_VERSION } from "../config/settings";
|
||||
import * as layers from "../config/layers.js";
|
||||
import useMapContextMenu from "./useMapContextMenu.js";
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
//-------------------- MapComponent -----------------------------------
|
||||
@@ -301,6 +302,12 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
); // Abhängigkeit zu hasRights hinzufügen
|
||||
|
||||
//-----Kontextmenu----ende------------
|
||||
|
||||
const { addItemsToMapContextMenu } = useMapContextMenu(
|
||||
map,
|
||||
hasRights,
|
||||
addStationCallback
|
||||
);
|
||||
//------------------------------------------ */
|
||||
const layerNames = {
|
||||
"GSM Modem": "GSMMODEM",
|
||||
@@ -884,7 +891,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
//------------------------------------------
|
||||
//--------------------------------------------------
|
||||
|
||||
const addItemsToMapContextMenu = () => {
|
||||
/* const addItemsToMapContextMenu = () => {
|
||||
if (!menuItemAdded) {
|
||||
//console.log("contextMenuItems hasRights:", hasRights);
|
||||
|
||||
@@ -897,7 +904,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
||||
|
||||
setMenuItemAdded(true); // Menüpunkt wurde hinzugefült, Zustand aktualisieren
|
||||
}
|
||||
};
|
||||
}; */
|
||||
|
||||
useEffect(() => {
|
||||
if (map && poiLayerRef.current && isPoiTypLoaded && !menuItemAdded) {
|
||||
|
||||
Reference in New Issue
Block a user