fix: 方向键持续触发

This commit is contained in:
unanmed 2024-11-20 22:28:22 +08:00
parent 392a391b75
commit 203fde1fbc
2 changed files with 2 additions and 1 deletions

View File

@ -19,6 +19,7 @@ body {
#game-draw { #game-draw {
position: relative; position: relative;
overflow: hidden;
} }
#game-draw > * { #game-draw > * {

View File

@ -228,9 +228,9 @@ export class Hotkey extends EventEmitter<HotkeyEvent> {
// 检查全局启用情况 // 检查全局启用情况
if (!this.enabled) return false; if (!this.enabled) return false;
const when = this.conditionMap.get(this.scope)!; const when = this.conditionMap.get(this.scope)!;
if (type === 'up') this.checkPressEnd(key);
if (!when()) return false; if (!when()) return false;
if (type === 'down') this.checkPress(key); if (type === 'down') this.checkPress(key);
else this.checkPressEnd(key);
const toEmit = this.keyMap.get(key); const toEmit = this.keyMap.get(key);
if (!toEmit) return false; if (!toEmit) return false;