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 @@
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 useEciMarkersLayer = (map, oms, GisSystemStatic, priorityConfig) => {
const [eciMarkers, setEciMarkers] = useState([]);
useEffect(() => {
if (GisSystemStatic && GisSystemStatic.length && map) {
createAndSetMarkers(2, setEciMarkers, GisSystemStatic, priorityConfig); // ECI-System
}
}, [GisSystemStatic, map, priorityConfig]);
useEffect(() => {
if (map && eciMarkers.length) {
eciMarkers.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, eciMarkers]);
return eciMarkers;
};
export default useEciMarkersLayer;