diff --git a/public/index.html b/public/index.html index 038b779868bc9c7e881cab273503029b99a8c805..bf4b17e6e5ff2f8d7d518492e7ee2b36d94a5d71 100644 --- a/public/index.html +++ b/public/index.html @@ -334,6 +334,10 @@ <link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" /> <script src="https://unpkg.com/leaflet/dist/leaflet.js"></script> <!-- Leaflet einbinden --> <script src="ar_overviewmap.js"></script> + + <!-- Audio-Element für Button-Klick --> + <audio id="button-sound" src="sounds/button-sound.mp3" preload="auto"></audio> + <script> // Variablen let selectedModel = 'robot'; @@ -367,6 +371,12 @@ window.onload = () => { initializeAddMenu(); + + // Fügt Sound zu allen Buttons hinzu + const buttons = document.querySelectorAll("button, .menu-item"); + buttons.forEach(button => { + button.addEventListener("click", playButtonSound); + }); }; function initializeAddMenu() { @@ -493,6 +503,7 @@ function completeEditing() { removeHighlightFromSelectedModel(); + closeDynamicMenu(); selectedPlacedModel = null; document.getElementById('edit-menu').style.display = 'none'; document.getElementById('menu-bar').style.display = 'flex'; @@ -695,6 +706,22 @@ document.getElementById('confirmation-dialog').style.display = 'none'; } + let soundTimeout = false; + + function playButtonSound() { + if (!soundTimeout) { + const sound = document.getElementById("button-sound"); + sound.currentTime = 0; + sound.play(); + + soundTimeout = true; + setTimeout(() => { + soundTimeout = false; + }, 200); // Verzögerung von 200ms + } + } + + if (navigator.xr) { const startButton = document.createElement('button'); startButton.textContent = 'Start AR'; diff --git a/public/sounds/button-sound.mp3 b/public/sounds/button-sound.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..49b6d2ab87e4324622804a03c0d714ed32b6f225 Binary files /dev/null and b/public/sounds/button-sound.mp3 differ