feat:Linien Mouse over polyline.setStyle
This commit is contained in:
@@ -5,7 +5,7 @@ import "leaflet/dist/leaflet.css";
|
|||||||
|
|
||||||
const circleIcon = L.divIcon({
|
const circleIcon = L.divIcon({
|
||||||
className: "custom-div-icon",
|
className: "custom-div-icon",
|
||||||
html: "<div style='background-color:gray;border-radius:50%;width:10px;height:10px;'></div>",
|
html: "<div style='background-color:gray;border-radius:50%;width:10px;height:10px;border: solid black 1px;'></div>",
|
||||||
iconSize: [25, 25],
|
iconSize: [25, 25],
|
||||||
iconAnchor: [5, 5],
|
iconAnchor: [5, 5],
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
import L from "leaflet";
|
import L from "leaflet";
|
||||||
const endIcon = L.divIcon({
|
const endIcon = L.divIcon({
|
||||||
className: "custom-end-icon",
|
className: "custom-end-icon",
|
||||||
html: "<div style='background-color: gray; width: 14px; height: 14px;'></div>", // Graues Viereck
|
html: "<div style='background-color: gray; width: 14px; height: 14px; border: solid black 2px;'></div>", // Graues Viereck
|
||||||
iconSize: [14, 14],
|
iconSize: [14, 14],
|
||||||
iconAnchor: [7, 7], // Mittelpunkt des Vierecks als Anker
|
iconAnchor: [7, 7], // Mittelpunkt des Vierecks als Anker
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1944,10 +1944,9 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
updatedPolyline.on("mouseover", () => {
|
updatedPolyline.on("mouseover", () => {
|
||||||
updatedPolyline.setStyle({ weight: 10 });
|
updatedPolyline.setStyle({ weight: 10 });
|
||||||
updatedPolyline.bringToFront();
|
updatedPolyline.bringToFront();
|
||||||
console.log("Mouse over");
|
|
||||||
});
|
});
|
||||||
updatedPolyline.on("mouseout", () => {
|
updatedPolyline.on("mouseout", () => {
|
||||||
updatedPolyline.setStyle({ weight: 5 });
|
updatedPolyline.setStyle({ weight: 3 });
|
||||||
console.log("Mouse out");
|
console.log("Mouse out");
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2045,10 +2044,14 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
|
|
||||||
polyline.on("mouseover", (e) => {
|
polyline.on("mouseover", (e) => {
|
||||||
// Optional: Visualisiere, dass die Linie interaktiv ist
|
// Optional: Visualisiere, dass die Linie interaktiv ist
|
||||||
polyline.setStyle({ color: "blue", weight: 10 });
|
//polyline.setStyle({ color: "blue", weight: 10 });
|
||||||
|
polyline.setStyle({ weight: 10 });
|
||||||
});
|
});
|
||||||
|
|
||||||
polyline.on("mouseout", (e) => {
|
polyline.on("mouseout", (e) => {
|
||||||
|
//polyline.setStyle({ color: "blue", weight: 3 });
|
||||||
|
polyline.setStyle({ weight: 3 });
|
||||||
|
|
||||||
// Setze die ursprüngliche Farbe zurück
|
// Setze die ursprüngliche Farbe zurück
|
||||||
polyline.setStyle({ color: lineColors[lineData.idModul] || "#000000" });
|
polyline.setStyle({ color: lineColors[lineData.idModul] || "#000000" });
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user