feat: highlight polylines on mouseover and bring to front

This commit is contained in:
ISA
2024-06-19 07:05:34 +02:00
parent 8947eef70f
commit 30ace5ad8a
3 changed files with 4 additions and 79 deletions

View File

@@ -2144,7 +2144,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
iconSize: [25, 25],
iconAnchor: [5, 5],
});
//---------------------------------------------------------
// Function to initialize markers and polylines
useEffect(() => {
if (!map) return;
@@ -2169,6 +2169,7 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
// Add mouseover and mouseout events to change the polyline width
polyline.on("mouseover", () => {
polyline.setStyle({ weight: 8 }); // Increase width on hover
polyline.bringToFront(); // Bring polyline to the front on hover
});
polyline.on("mouseout", () => {