Mit Spider funktioniert etwas, es soll noch beim Klick wieder ausgeblendet werden
This commit is contained in:
@@ -323,6 +323,10 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
'© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
||||||
}).addTo(initialMap);
|
}).addTo(initialMap);
|
||||||
|
|
||||||
|
const newOms = new OverlappingMarkerSpiderfier(initialMap, {
|
||||||
|
nearbyDistance: 50,
|
||||||
|
});
|
||||||
|
setOms(newOms);
|
||||||
setMap(initialMap);
|
setMap(initialMap);
|
||||||
}
|
}
|
||||||
}, [mapRef, map]);
|
}, [mapRef, map]);
|
||||||
@@ -644,7 +648,7 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
//Informationen in Tooltips einfügen
|
//Informationen in Tooltips einfügen
|
||||||
// Marker hinzufügen für GisStationsStaticDistrict
|
// Marker hinzufügen für GisStationsStaticDistrict
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (map && GisStationsStaticDistrict.length > 0) {
|
if (map && oms && GisStationsStaticDistrict.length > 0) {
|
||||||
map.eachLayer((layer) => {
|
map.eachLayer((layer) => {
|
||||||
if (layer instanceof L.Marker) {
|
if (layer instanceof L.Marker) {
|
||||||
map.removeLayer(layer);
|
map.removeLayer(layer);
|
||||||
@@ -686,9 +690,9 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
shadowSize: [41, 41],
|
shadowSize: [41, 41],
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
//oms.addMarker(marker); // Marker zum OMS hinzufügen
|
|
||||||
marker.addTo(map);
|
|
||||||
|
|
||||||
|
marker.addTo(map);
|
||||||
|
oms.addMarker(marker); // Add marker to the OverlappingMarkerSpiderfier instance
|
||||||
marker.on("mouseover", function (e) {
|
marker.on("mouseover", function (e) {
|
||||||
this.openPopup();
|
this.openPopup();
|
||||||
});
|
});
|
||||||
@@ -704,7 +708,7 @@ const MapComponent = ({ locations, onLocationUpdate }) => {
|
|||||||
.openPopup();
|
.openPopup();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, [map, GisStationsStaticDistrict, GisStationsStatusDistrict]); // Include GisStationsStatusDistrict in dependencies
|
}, [map, GisStationsStaticDistrict, oms, GisStationsStatusDistrict]); // Include GisStationsStatusDistrict in dependencies
|
||||||
|
|
||||||
//------------------------------------------
|
//------------------------------------------
|
||||||
// Funktion, die den Pfad zum entsprechenden Icon basierend auf dem Status generiert
|
// Funktion, die den Pfad zum entsprechenden Icon basierend auf dem Status generiert
|
||||||
|
|||||||
Reference in New Issue
Block a user