fix: 优化移动手感

This commit is contained in:
AncTe committed 2024-08-26 21:55:42 +08:00
1 parent 1c369251b1
commit e5afdb73fd
3 files changed
+46 -41

No files matched your search

+4 -4
View File
@@ -86,7 +86,8 @@ export class Hotkey extends EventEmitter<HotkeyEvent> {
enabled: boolean = false;
conditionMap: Map<symbol, () => boolean> = new Map();
private scope: symbol = Symbol();
/** 当前作用域 */
scope: symbol = Symbol();
private scopeStack: symbol[] = [];
private grouping: string = 'none';
@@ -226,6 +227,8 @@ export class Hotkey extends EventEmitter<HotkeyEvent> {
// 检查全局启用情况
if (!this.enabled) return false;
const when = this.conditionMap.get(this.scope)!;
if (type === 'down') this.checkPress(key);
else this.checkPressEnd(key);
if (!when()) return false;
const toEmit = this.keyMap.get(key);
if (!toEmit) return false;
@@ -253,9 +256,6 @@ export class Hotkey extends EventEmitter<HotkeyEvent> {
});
this.emit('emit', key, assist, type);
if (type === 'down') this.checkPress(key);
else this.checkPressEnd(key);
return emitted;
}
+4
View File
@@ -289,4 +289,8 @@ export class LayerOpenDoorAnimate implements ILayerRenderExtends {
awake(layer: Layer) {
this.layer = layer;
}
openDoor(x: number, y: number) {}
closeDoor(x: number, y: number) {}
}