fix: 修复在切换至标准模式后,方向键未正确释放的问题 (#270)

This commit is contained in:
ayangweb
2025-05-13 22:43:35 +08:00
committed by GitHub
parent 91de4d0ba9
commit bddc48357b

View File

@@ -1,7 +1,7 @@
import type { Ref } from 'vue'
import { useDebounceFn } from '@vueuse/core'
import { reactive, ref } from 'vue'
import { reactive, ref, watch } from 'vue'
import { LISTEN_KEY } from '../constants'
@@ -49,6 +49,10 @@ export function useDevice() {
const pressedKeys = ref<string[]>([])
const catStore = useCatStore()
watch(() => catStore.mode, () => {
pressedKeys.value = pressedKeys.value.filter(key => !key.endsWith('Arrow'))
})
const debounceCapsLockRelease = useDebounceFn(() => {
handleRelease(pressedKeys, 'CapsLock')
}, 100)