WIP: neu Tab mit icon für ToolTip

This commit is contained in:
ISA
2024-12-12 09:36:50 +01:00
parent e9ce6088b8
commit 93bf7a5cac

View File

@@ -2,6 +2,8 @@
import { addContextMenuToMarker } from "../../utils/addContextMenuToMarker";
const useGmaMarkersLayer = (map, markers, GisStationsMeasurements, GMA, oms, isVisible) => {
const host = window.location.origin;
const url = `${host}/talas5/devices/`;
useEffect(() => {
if (!map || !isVisible) return;
@@ -70,10 +72,25 @@ const useGmaMarkersLayer = (map, markers, GisStationsMeasurements, GMA, oms, isV
menu.style.padding = "8px";
menu.style.zIndex = "1000";
// Menüeinträge hinzufügen
// Menüeintrag mit Icon erstellen
const openStation = document.createElement("div");
openStation.textContent = "Station öffnen (Tab)";
openStation.style.display = "flex";
openStation.style.alignItems = "center";
openStation.style.cursor = "pointer";
const icon = document.createElement("img");
icon.src = "/img/screen_new.png"; // Pfad zum Icon
icon.alt = "Icon";
icon.style.width = "16px";
icon.style.height = "16px";
icon.style.marginRight = "8px";
const text = document.createElement("span");
text.textContent = "Station öffnen (Tab)";
openStation.appendChild(icon);
openStation.appendChild(text);
openStation.onclick = () => {
if (marker.options.link) {
window.open(marker.options.link, "_blank");
@@ -83,18 +100,8 @@ const useGmaMarkersLayer = (map, markers, GisStationsMeasurements, GMA, oms, isV
document.body.removeChild(menu); // Menü entfernen
};
const showDetails = document.createElement("div");
showDetails.textContent = "Details anzeigen";
showDetails.style.cursor = "pointer";
showDetails.onclick = () => {
alert(`Details für ${area_name}`);
document.body.removeChild(menu); // Menü entfernen
};
// Menüeinträge zum Menü hinzufügen
menu.appendChild(openStation);
menu.appendChild(document.createElement("hr"));
menu.appendChild(showDetails);
// Menü zum DOM hinzufügen
document.body.appendChild(menu);