Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ソング] undoとredoのショートカットキー登録 #1861

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading