fix: 存档界面按键报错

This commit is contained in:
unanmed 2025-06-20 17:38:23 +08:00
parent 1f6cbea3ac
commit 9826866c94
2 changed files with 7 additions and 2 deletions

View File

@ -66,6 +66,7 @@ export const SaveBtn = defineComponent<SaveBtnProps>(props => {
fillStyle="gray" fillStyle="gray"
strokeStyle={strokeStyle.value} strokeStyle={strokeStyle.value}
lineWidth={lineWidth.value} lineWidth={lineWidth.value}
lineJoin="miter"
/> />
<text <text
text="placeholder" text="placeholder"
@ -90,6 +91,7 @@ export const Save = defineComponent<SaveProps, SaveEmits, keyof SaveEmits>(
/** 除自动存档外,每一页容纳的存档数量 */ /** 除自动存档外,每一页容纳的存档数量 */
const pageCap = row * column - 1; const pageCap = row * column - 1;
const font = new Font('normal', 18); const font = new Font('normal', 18);
const pageFont = new Font('normal', 14);
const isDelete = ref(false); const isDelete = ref(false);
const pageRef = ref<PageExpose>(); const pageRef = ref<PageExpose>();
@ -198,6 +200,7 @@ export const Save = defineComponent<SaveProps, SaveEmits, keyof SaveEmits>(
pages={1000} pages={1000}
onWheel={wheel} onWheel={wheel}
ref={pageRef} ref={pageRef}
font={pageFont}
> >
{(page: number) => ( {(page: number) => (
<container loc={[0, 0, MAP_WIDTH, MAP_HEIGHT]}> <container loc={[0, 0, MAP_WIDTH, MAP_HEIGHT]}>
@ -259,6 +262,7 @@ export const Save = defineComponent<SaveProps, SaveEmits, keyof SaveEmits>(
zIndex={10} zIndex={10}
fillStyle={isDelete.value ? 'red' : 'white'} fillStyle={isDelete.value ? 'red' : 'white'}
onClick={toggleDelete} onClick={toggleDelete}
cursor="pointer"
/> />
<text <text
text="返回游戏" text="返回游戏"
@ -266,6 +270,7 @@ export const Save = defineComponent<SaveProps, SaveEmits, keyof SaveEmits>(
loc={[450, 450, void 0, void 0, 1, 0]} loc={[450, 450, void 0, void 0, 1, 0]}
zIndex={10} zIndex={10}
onClick={exit} onClick={exit}
cursor="pointer"
/> />
</container> </container>
); );

View File

@ -232,10 +232,10 @@ export class Hotkey extends EventEmitter<HotkeyEvent> {
): boolean { ): boolean {
// 检查全局启用情况 // 检查全局启用情况
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 (type === 'up') this.checkPressEnd(key);
else if (type === 'down') this.checkPress(key); else if (type === 'down') this.checkPress(key);
if (!when()) return false; if (when && !when()) return false;
const toEmit = this.keyMap.get(key); const toEmit = this.keyMap.get(key);
if (!toEmit) return false; if (!toEmit) return false;