fix: 打字机速度 & 选择框确认框界面按键报错

This commit is contained in:
unanmed 2025-09-11 23:08:10 +08:00
parent b74c61b8ba
commit 1ce79154d2
3 changed files with 4 additions and 18 deletions

View File

@ -94,7 +94,7 @@ export const ConfirmBox = defineComponent<
}); });
const yesText = computed(() => props.yesText ?? '确认'); const yesText = computed(() => props.yesText ?? '确认');
const noText = computed(() => props.noText ?? '取消'); const noText = computed(() => props.noText ?? '取消');
const pad = computed(() => props.pad ?? 32); const pad = computed(() => props.pad ?? 24);
const yesLoc = computed<ElementLocator>(() => { const yesLoc = computed<ElementLocator>(() => {
const y = height.value - pad.value; const y = height.value - pad.value;
return [props.width / 3, y, void 0, void 0, 0.5, 1]; return [props.width / 3, y, void 0, void 0, 0.5, 1];

View File

@ -462,7 +462,7 @@ export class TextContentTyper extends EventEmitter<TextContentTyperEvent> {
renderable.cut = false; renderable.cut = false;
const chars = renderable.text.length - renderable.pointer; const chars = renderable.text.length - renderable.pointer;
if (chars >= rest) { if (chars >= rest) {
renderable.pointer += chars; renderable.pointer += rest;
return false; return false;
} else { } else {
renderable.pointer = renderable.text.length; renderable.pointer = renderable.text.length;
@ -1257,7 +1257,7 @@ export class TextContentParser {
if ( if (
breakChars.has(char) || breakChars.has(char) ||
isCJK(char.charCodeAt(0)) || isCJK(char.charCodeAt(0)) ||
isCJK(next.charCodeAt(0)) isCJK(next?.charCodeAt(0))
) { ) {
this.wordBreak.push(pointer + 1); this.wordBreak.push(pointer + 1);
const rest = width - this.lineWidth; const rest = width - this.lineWidth;

View File

@ -1222,21 +1222,7 @@ actions.prototype._clickAction = function (x, y, px, py) {
}; };
////// 自定义事件时,按下某个键的操作 ////// ////// 自定义事件时,按下某个键的操作 //////
actions.prototype._keyDownAction = function (keycode) { actions.prototype._keyDownAction = function (keycode) {};
if (core.status.event.data.type == 'choices') {
this._keyDownChoices(keycode);
return;
}
if (
core.status.event.data.type == 'confirm' &&
(keycode == 37 || keycode == 39)
) {
core.status.event.selection = 1 - core.status.event.selection;
core.playSound('光标移动');
core.drawConfirmBox(core.status.event.ui.text);
return;
}
};
////// 自定义事件时,放开某个键的操作 ////// ////// 自定义事件时,放开某个键的操作 //////
actions.prototype._keyUpAction = function (keycode) { actions.prototype._keyUpAction = function (keycode) {