diff --git a/public/index.html b/public/index.html index 3a71fa5d1ec79e71240bd51365e895150ccfbce5..167cc757d782350162bca8857480d5bc21925ba9 100644 --- a/public/index.html +++ b/public/index.html @@ -285,6 +285,9 @@ </div> </div> + <!-- Audio-Element für Button-Klick --> + <audio id="button-sound" src="click.mp3" preload="auto"></audio> + <script> // Variablen let selectedModel = 'robot'; @@ -318,6 +321,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() { @@ -443,6 +452,7 @@ function completeEditing() { removeHighlightFromSelectedModel(); + closeDynamicMenu(); selectedPlacedModel = null; document.getElementById('edit-menu').style.display = 'none'; document.getElementById('menu-bar').style.display = 'flex'; @@ -636,6 +646,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/click.mp3 b/public/sounds/click.mp3 new file mode 100644 index 0000000000000000000000000000000000000000..eeb9acb07be29ea750e6e4c6daee0c4ddd3b88fd Binary files /dev/null and b/public/sounds/click.mp3 differ