return one step or fix it
This commit is contained in:
@@ -2297,10 +2297,32 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
color: lineColors[lineData.idModul] || "#000000",
|
color: lineColors[lineData.idModul] || "#000000",
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
|
|
||||||
|
// Dynamisch generierter Tooltip-Inhalt
|
||||||
|
const matchingStatus = lineStatusData.find(
|
||||||
|
(stat) =>
|
||||||
|
stat.IdLD === lineData.idLD && stat.Modul === lineData.idModul
|
||||||
|
);
|
||||||
|
|
||||||
|
const dynamicTooltipContent = matchingStatus
|
||||||
|
? `
|
||||||
|
<div class="p-0 rounded-lg bg-white bg-opacity-90">
|
||||||
|
<div class="font-bold text-sm text-black">
|
||||||
|
<span>DpName: ${matchingStatus.DpName || "Unknown"}</span>
|
||||||
|
</div>
|
||||||
|
<div class="font-bold text-xxs text-blue-700">
|
||||||
|
<span>ModulName: ${matchingStatus.ModulName || "N/A"}</span>
|
||||||
|
</div>
|
||||||
|
<div class="font-bold text-xxs text-red-700">
|
||||||
|
<span>Message: ${matchingStatus.Message || "N/A"}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
: "Informationen oder Name der Linie";
|
||||||
|
|
||||||
// Hinzufügen eines Tooltips
|
// Hinzufügen eines Tooltips
|
||||||
updatedPolyline.bindTooltip(tooltipContent, {
|
updatedPolyline.bindTooltip(dynamicTooltipContent, {
|
||||||
permanent: false, // true, wenn Sie möchten, dass der Tooltip immer sichtbar ist
|
permanent: false,
|
||||||
direction: "auto", // Kann 'right', 'left', 'top' oder 'bottom' sein
|
direction: "auto",
|
||||||
});
|
});
|
||||||
|
|
||||||
updatedPolyline.on("mouseover", () => {
|
updatedPolyline.on("mouseover", () => {
|
||||||
@@ -2352,14 +2374,35 @@ const MapComponent = ({ locations, onLocationUpdate, lineCoordinates }) => {
|
|||||||
lineMarkers.push(marker);
|
lineMarkers.push(marker);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Dynamisch generierter Tooltip-Inhalt
|
||||||
|
const matchingStatus = lineStatusData.find(
|
||||||
|
(stat) => stat.IdLD === lineData.idLD && stat.Modul === lineData.idModul
|
||||||
|
);
|
||||||
|
|
||||||
|
const dynamicTooltipContent = matchingStatus
|
||||||
|
? `
|
||||||
|
<div class="p-0 rounded-lg bg-white bg-opacity-90">
|
||||||
|
<div class="font-bold text-sm text-black">
|
||||||
|
<span>DpName: ${matchingStatus.DpName || "Unknown"}</span>
|
||||||
|
</div>
|
||||||
|
<div class="font-bold text-xxs text-blue-700">
|
||||||
|
<span>ModulName: ${matchingStatus.ModulName || "N/A"}</span>
|
||||||
|
</div>
|
||||||
|
<div class="font-bold text-xxs text-red-700">
|
||||||
|
<span>Message: ${matchingStatus.Message || "N/A"}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
|
: "Informationen oder Name der Linie";
|
||||||
|
|
||||||
// Erstellen der initialen Polyline und Einrichten eines Tooltips
|
// Erstellen der initialen Polyline und Einrichten eines Tooltips
|
||||||
const polyline = L.polyline(lineData.coordinates, {
|
const polyline = L.polyline(lineData.coordinates, {
|
||||||
color: lineColors[lineData.idModul] || "#000000",
|
color: lineColors[lineData.idModul] || "#000000",
|
||||||
}).addTo(map);
|
}).addTo(map);
|
||||||
|
|
||||||
polyline.bindTooltip(tooltipContent, {
|
polyline.bindTooltip(dynamicTooltipContent, {
|
||||||
permanent: false, // true, wenn Sie möchten, dass der Tooltip immer sichtbar ist
|
permanent: false,
|
||||||
direction: "auto", // Kann 'right', 'left', 'top' oder 'bottom' sein
|
direction: "auto",
|
||||||
});
|
});
|
||||||
|
|
||||||
polyline.on("mouseover", () => {
|
polyline.on("mouseover", () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user