Skip to content

Commit

Permalink
[ソング] undoとredoのショートカットキー登録 (#1861)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hiroshiba authored Feb 21, 2024
1 parent 3869583 commit 1614db5
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
30 changes: 25 additions & 5 deletions src/components/Sing/ToolBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,34 @@ import CharacterMenuButton from "@/components/Sing/CharacterMenuButton/MenuButto
import { useHotkeyManager } from "@/plugins/hotkeyPlugin";
const store = useStore();
const uiLocked = computed(() => store.getters.UI_LOCKED);
const editor = "song";
const canUndo = computed(() => store.getters.CAN_UNDO(editor));
const canRedo = computed(() => store.getters.CAN_REDO(editor));
const { registerHotkeyWithCleanup } = useHotkeyManager();
registerHotkeyWithCleanup({
editor,
name: "元に戻す",
callback: () => {
if (!uiLocked.value && canUndo.value) {
undo();
}
},
});
registerHotkeyWithCleanup({
editor,
name: "やり直す",
callback: () => {
if (!uiLocked.value && canRedo.value) {
redo();
}
},
});
registerHotkeyWithCleanup({
editor: "song",
editor,
name: "再生/停止",
callback: () => {
if (nowPlaying.value) {
Expand All @@ -150,10 +174,6 @@ registerHotkeyWithCleanup({
},
});
const editor = "song";
const canUndo = computed(() => store.getters.CAN_UNDO(editor));
const canRedo = computed(() => store.getters.CAN_REDO(editor));
const undo = () => {
store.dispatch("UNDO", { editor });
};
Expand Down
6 changes: 3 additions & 3 deletions src/components/Talk/ToolBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const nowPlayingContinuously = computed(
const { registerHotkeyWithCleanup } = useHotkeyManager();
registerHotkeyWithCleanup({
editor: "talk",
editor,
name: "元に戻す",
callback: () => {
if (!uiLocked.value && canUndo.value) {
Expand All @@ -63,7 +63,7 @@ registerHotkeyWithCleanup({
},
});
registerHotkeyWithCleanup({
editor: "talk",
editor,
name: "やり直す",
callback: () => {
if (!uiLocked.value && canRedo.value) {
Expand All @@ -73,7 +73,7 @@ registerHotkeyWithCleanup({
});
registerHotkeyWithCleanup({
editor: "talk",
editor,
name: "連続再生/停止",
callback: () => {
if (!uiLocked.value) {
Expand Down

0 comments on commit 1614db5

Please sign in to comment.