polylines tooltip content
This commit is contained in:
37
hooks/useMessstellenMarkersLayer.js
Normal file
37
hooks/useMessstellenMarkersLayer.js
Normal file
@@ -0,0 +1,37 @@
|
||||
import { useEffect, useState } from "react";
|
||||
import L from "leaflet";
|
||||
import { addContextMenuToMarker } from "../utils/contextMenuUtils";
|
||||
import { createAndSetMarkers } from "../utils/markerUtils";
|
||||
|
||||
const useMessstellenMarkersLayer = (map, oms, GisSystemStatic, priorityConfig) => {
|
||||
const [messstellenMarkers, setMessstellenMarkers] = useState([]);
|
||||
|
||||
useEffect(() => {
|
||||
if (GisSystemStatic && GisSystemStatic.length && map) {
|
||||
createAndSetMarkers(13, setMessstellenMarkers, GisSystemStatic, priorityConfig); // Messstellen
|
||||
}
|
||||
}, [GisSystemStatic, map, priorityConfig]);
|
||||
|
||||
useEffect(() => {
|
||||
if (map && messstellenMarkers.length) {
|
||||
messstellenMarkers.forEach((marker) => {
|
||||
marker.addTo(map);
|
||||
oms.addMarker(marker);
|
||||
|
||||
// Popup on mouseover and mouseout
|
||||
marker.on("mouseover", function () {
|
||||
this.openPopup();
|
||||
});
|
||||
marker.on("mouseout", function () {
|
||||
this.closePopup();
|
||||
});
|
||||
|
||||
addContextMenuToMarker(marker);
|
||||
});
|
||||
}
|
||||
}, [map, messstellenMarkers, oms]);
|
||||
|
||||
return messstellenMarkers;
|
||||
};
|
||||
|
||||
export default useMessstellenMarkersLayer;
|
||||
Reference in New Issue
Block a user