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"; import { addContextMenuToMarker } from "../../utils/addContextMenuToMarker";
const useGmaMarkersLayer = (map, markers, GisStationsMeasurements, GMA, oms, isVisible) => { const useGmaMarkersLayer = (map, markers, GisStationsMeasurements, GMA, oms, isVisible) => {
const host = window.location.origin;
const url = `${host}/talas5/devices/`;
useEffect(() => { useEffect(() => {
if (!map || !isVisible) return; if (!map || !isVisible) return;
@@ -70,10 +72,25 @@ const useGmaMarkersLayer = (map, markers, GisStationsMeasurements, GMA, oms, isV
menu.style.padding = "8px"; menu.style.padding = "8px";
menu.style.zIndex = "1000"; menu.style.zIndex = "1000";
// Menüeinträge hinzufügen // Menüeintrag mit Icon erstellen
const openStation = document.createElement("div"); const openStation = document.createElement("div");
openStation.textContent = "Station öffnen (Tab)"; openStation.style.display = "flex";
openStation.style.alignItems = "center";
openStation.style.cursor = "pointer"; 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 = () => { openStation.onclick = () => {
if (marker.options.link) { if (marker.options.link) {
window.open(marker.options.link, "_blank"); window.open(marker.options.link, "_blank");
@@ -83,18 +100,8 @@ const useGmaMarkersLayer = (map, markers, GisStationsMeasurements, GMA, oms, isV
document.body.removeChild(menu); // Menü entfernen 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 // Menüeinträge zum Menü hinzufügen
menu.appendChild(openStation); menu.appendChild(openStation);
menu.appendChild(document.createElement("hr"));
menu.appendChild(showDetails);
// Menü zum DOM hinzufügen // Menü zum DOM hinzufügen
document.body.appendChild(menu); document.body.appendChild(menu);