polylines tooltip content

This commit is contained in:
ISA
2024-08-10 10:32:37 +02:00
parent b1f7b700ca
commit b7116a1e6f
142 changed files with 14451 additions and 4281 deletions

View File

@@ -0,0 +1,47 @@
// hooks/useGsmModemMarkersLayer.js
import { useEffect, useState } from "react";
import L from "leaflet";
import { createAndSetMarkers } from "../utils/markerUtils";
import { addContextMenuToMarker } from "../utils/contextMenuUtils";
import { checkOverlappingMarkers } from "../utils/mapUtils";
const useGsmModemMarkersLayer = (map, oms, GisSystemStatic, priorityConfig) => {
const [gsmModemMarkers, setGsmModemMarkers] = useState([]);
useEffect(() => {
if (GisSystemStatic && GisSystemStatic.length && map) {
createAndSetMarkers(5, setGsmModemMarkers, GisSystemStatic, priorityConfig); // GSM-Modem
}
}, [GisSystemStatic, map, priorityConfig]);
useEffect(() => {
if (map && gsmModemMarkers.length) {
gsmModemMarkers.forEach((marker) => {
marker.addTo(map);
oms.addMarker(marker);
// Popup beim Überfahren mit der Maus öffnen und schließen
marker.on("mouseover", function () {
this.openPopup();
});
marker.on("mouseout", function () {
this.closePopup();
});
addContextMenuToMarker(marker);
});
// Disable map context menu
map.options.contextmenu = false;
map.options.contextmenuItems = [];
oms.map.options.contextmenu = false;
oms.map.options.contextmenuItems = [];
// Call the function to check for overlapping markers
checkOverlappingMarkers(oms, map);
}
}, [map, gsmModemMarkers]);
return gsmModemMarkers;
};
export default useGsmModemMarkersLayer;