diff --git a/public/js/map-ui.js b/public/js/map-ui.js index e3b40cf..0ed3ccc 100644 --- a/public/js/map-ui.js +++ b/public/js/map-ui.js @@ -7,10 +7,18 @@ const tooltip = document.getElementById("map-tooltip"); const tooltipCache = {}; +// Tooltip verstecken wenn Maus über Quickmenu oder Popup fährt +document.getElementById("quickmenu-panel")?.addEventListener("mouseenter", () => { + tooltip.style.display = "none"; +}); +document.getElementById("building-popup")?.addEventListener("mouseenter", () => { + tooltip.style.display = "none"; +}); + const buildingModules = { - 11: loadCharacterHouse, // Tabs ausblenden, eigenes UI + 11: loadCharacterHouse, // Tabs ausblenden, eigenes UI 12: loadBlackmarket, // Tabs ausblenden, eigenes UI - 10: loadMine, // Tabs bleiben sichtbar, nur Aktionen-Tab befüllen + 10: loadMine, // Tabs bleiben sichtbar, nur Aktionen-Tab befüllen }; // Gebäude die ihre eigenen Tabs behalten sollen @@ -60,8 +68,14 @@ async function openBuildingPopup(url) { - + `; @@ -76,7 +90,7 @@ async function openBuildingPopup(url) { tabs.style.display = "none"; infoTab.innerHTML = `
`; } - buildingModules[buildingType](url.split("/").pop()); + buildingModules[buildingType](url.split('/').pop()); } // Punkte-Check: Upgrade nur möglich wenn genug Punkte vorhanden @@ -110,8 +124,8 @@ async function openBuildingPopup(url) { - ${!hasEnoughPoints ? `

Noch ${data.upgradeRequiredPoints - data.points} Punkte bis zum Upgrade.

` : ""} @@ -152,11 +166,7 @@ document.addEventListener("click", async (e) => { const data = await res.json(); if (!res.ok || data.error) { - window.showNotification( - data.error || "Upgrade fehlgeschlagen.", - "Upgrade", - "⚒️", - ); + window.showNotification(data.error || "Upgrade fehlgeschlagen.", "Upgrade", "⚒️"); btn.disabled = false; btn.textContent = "⚒ UPGRADE STARTEN ⚒"; return; @@ -165,7 +175,7 @@ document.addEventListener("click", async (e) => { window.showNotification( `Upgrade erfolgreich!\nNeues Level: ${data.newLevel}\n\nKosten: ${data.cost.wood} Holz, ${data.cost.stone} Stein, ${data.cost.gold} Gold`, "Upgrade", - "⚒️", + "⚒️" ); // Popup mit frischen Daten neu laden @@ -173,13 +183,10 @@ document.addEventListener("click", async (e) => { // HUD aktualisieren import("/js/hud.js").then(({ loadHud }) => loadHud()); + } catch (err) { console.error("Upgrade Fehler:", err); - window.showNotification( - "Fehler beim Upgrade. Bitte erneut versuchen.", - "Fehler", - "⚠️", - ); + window.showNotification("Fehler beim Upgrade. Bitte erneut versuchen.", "Fehler", "⚠️"); btn.disabled = false; btn.textContent = "⚒ UPGRADE STARTEN ⚒"; } @@ -260,7 +267,7 @@ document.querySelectorAll(".building").forEach((building) => { if (y + th > window.innerHeight - 10) y = e.clientY - th - 10; tooltip.style.left = x + "px"; - tooltip.style.top = y + "px"; + tooltip.style.top = y + "px"; }); building.addEventListener("mouseleave", () => {