diff --git a/src/App.vue b/src/App.vue index d2b4a03..5ab00d8 100644 --- a/src/App.vue +++ b/src/App.vue @@ -16,11 +16,10 @@ import MapEditor from '@/components/screens/MapEditor.vue' import BackgroundImageLoader from '@/components/utilities/BackgroundImageLoader.vue' import Debug from '@/components/utilities/Debug.vue' import Notifications from '@/components/utilities/Notifications.vue' +import { useGameComposable } from '@/composables/useGameComposable' import { useMapEditorComposable } from '@/composables/useMapEditorComposable' import { useGameStore } from '@/stores/gameStore' -import { useMapEditorStore } from '@/stores/mapEditorStore' -import { computed, ref, useTemplateRef, watch } from 'vue' -import { useGameComposable } from '@/composables/useGameComposable' +import { computed, watch } from 'vue' const gameStore = useGameStore() @@ -45,9 +44,13 @@ watch( ) // #209: Play sound when a button is pressed -// @TODO: Not all button-like elements will actually be a button, so we need to find a better way to do this addEventListener('click', (event) => { - if (!(event.target instanceof HTMLButtonElement)) return + const classList = ['btn-cyan', 'btn-red', 'btn-indigo', 'btn-empty', 'btn-sound'] + const target = event.target as HTMLElement + // console.log(target) // Uncomment to log the clicked element + if (!classList.some((className) => target.classList.contains(className))) { + return // Only play sound if the clicked element is a button + } playSound('/assets/sounds/button-click.wav') }) diff --git a/src/components/screens/Characters.vue b/src/components/screens/Characters.vue index 8f921da..f05c81e 100644 --- a/src/components/screens/Characters.vue +++ b/src/components/screens/Characters.vue @@ -18,11 +18,11 @@