Skip to content

Commit

Permalink
FIX: シフトキーや上下キーの問題の解決
Browse files Browse the repository at this point in the history
  • Loading branch information
tsym77yoshi committed Mar 30, 2024
1 parent ec0ad81 commit 506b8a1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
9 changes: 5 additions & 4 deletions src/components/Talk/TalkEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,14 @@ const removeAudioItem = async () => {
const onCharacterSelectHotkey = async (e: KeyboardEvent) => {
if (activeAudioKey.value == undefined) throw new Error();
const convertToNumber = (str: string) => {
if (/^[0-9]$/.test(str)) {
return parseInt(str, 10);
const eventKey = str.replace(/Digit|Numpad/, "");
if (/^[0-9]$/.test(eventKey)) {
return parseInt(eventKey, 10);
} else {
throw new Error(`onCharacterSelectHotkey Invalid key: ${str}`);
throw new Error(`onCharacterSelectHotkey Invalid key: ${eventKey}`);
}
};
const convertedKey = convertToNumber(e.key);
const convertedKey = convertToNumber(e.code);
const selectedCharacterIndex = convertedKey != 0 ? convertedKey - 1 : 9;
audioCellRefs[activeAudioKey.value].selectCharacterAt(selectedCharacterIndex);
};
Expand Down
10 changes: 5 additions & 5 deletions src/plugins/hotkeyPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,13 +317,13 @@ export const getArgumentKeyCombination = (
HotkeyCombination(String(index))
);
} else if (argumentKey == "VerticalArrows") {
return [HotkeyCombination("ArrowUp"), HotkeyCombination("ArrowDown")];
return [HotkeyCombination("Up"), HotkeyCombination("Down")];
} else if (argumentKey == "Arrows") {
return [
HotkeyCombination("ArrowLeft"),
HotkeyCombination("ArrowRight"),
HotkeyCombination("ArrowUp"),
HotkeyCombination("ArrowDown"),
HotkeyCombination("Left"),
HotkeyCombination("Right"),
HotkeyCombination("Up"),
HotkeyCombination("Down"),
];
}
throw new Error(`Received unexpected HotkeyArgumentKeyType`);
Expand Down

0 comments on commit 506b8a1

Please sign in to comment.