Skip to content

Commit

Permalink
表示メニューを追加し右下シンガー表示を切り替えられるようにする (#2219)
Browse files Browse the repository at this point in the history
* 表示メニューを追加

* sing用storeではなく設定storeを利用する [update snapshots]

* (スナップショットを更新)

* Update src/components/Sing/menuBarData.ts

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Hiroshiba <hihokaruta@gmail.com>
  • Loading branch information
3 people committed Aug 14, 2024
1 parent 12e05a3 commit ccba185
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 23 deletions.
1 change: 1 addition & 0 deletions src/components/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
v-if="openedEditor != undefined"
:fileSubMenuData="subMenuData.fileSubMenuData.value"
:editSubMenuData="subMenuData.editSubMenuData.value"
:viewSubMenuData="subMenuData.viewSubMenuData.value"
:editor="openedEditor"
/>
<KeepAlive>
Expand Down
11 changes: 11 additions & 0 deletions src/components/Menu/MenuBar/MenuBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ const props = defineProps<{
fileSubMenuData: MenuItemData[];
/** 「編集」メニューのサブメニュー */
editSubMenuData: MenuItemData[];
/** 「表示」メニューのサブメニュー */
viewSubMenuData: MenuItemData[];
/** エディタの種類 */
editor: "talk" | "song";
}>();
Expand Down Expand Up @@ -387,6 +389,15 @@ const menudata = computed<MenuItemData[]>(() => [
...props.editSubMenuData,
],
},
{
type: "root",
label: "表示",
onClick: () => {
closeAllDialog();
},
disableWhenUiLocked: false,
subMenu: [...props.viewSubMenuData],
},
{
type: "root",
label: "エンジン",
Expand Down
4 changes: 2 additions & 2 deletions src/components/Sing/CharacterPortrait.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div class="character-portrait-wrap" :class="{ hide: !isShowSinger }">
<div v-if="showSinger" class="character-portrait-wrap">
<img class="character-portrait" :src="portraitPath" />
</div>
</template>
Expand All @@ -9,7 +9,7 @@ import { computed } from "vue";
import { useStore } from "@/store";
const store = useStore();
const isShowSinger = computed(() => store.state.isShowSinger);
const showSinger = computed(() => store.state.showSinger);
const portraitPath = computed(() => {
const userOrderedCharacterInfos =
Expand Down
22 changes: 21 additions & 1 deletion src/components/Sing/menuBarData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ export const useMenuBarData = () => {
const isNotesSelected = computed(
() => store.getters.SELECTED_NOTE_IDS.size > 0,
);
const showSinger = computed({
get: () => store.state.showSinger,
set: (showSinger: boolean) => {
void store.dispatch("SET_ROOT_MISC_SETTING", {
key: "showSinger",
value: showSinger,
});
},
});

const importExternalSongProject = async () => {
if (uiLocked.value) return;
Expand Down Expand Up @@ -105,5 +114,16 @@ export const useMenuBarData = () => {
},
]);

return { fileSubMenuData, editSubMenuData };
const viewSubMenuData = computed<MenuItemData[]>(() => [
{
type: "button",
label: showSinger.value ? "立ち絵を非表示" : "立ち絵を表示",
onClick: () => {
showSinger.value = !showSinger.value;
},
disableWhenUiLocked: true,
},
]);

return { fileSubMenuData, editSubMenuData, viewSubMenuData };
};
4 changes: 4 additions & 0 deletions src/components/Talk/menuBarData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,12 @@ export const useMenuBarData = () => {
// 「編集」メニュー
const editSubMenuData = computed<MenuItemData[]>(() => []);

// 「表示」メニュー
const viewSubMenuData = computed<MenuItemData[]>(() => []);

return {
fileSubMenuData,
editSubMenuData,
viewSubMenuData,
};
};
2 changes: 2 additions & 0 deletions src/store/setting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export const settingStoreState: SettingStoreState = {
soloAndMute: true,
panAndGain: true,
},
showSinger: true,
};

export const settingStore = createPartialStore<SettingStoreTypes>({
Expand Down Expand Up @@ -146,6 +147,7 @@ export const settingStore = createPartialStore<SettingStoreTypes>({
"enableMemoNotation",
"skipUpdateVersion",
"undoableTrackOperations",
"showSinger",
] as const;

// rootMiscSettingKeysに値を足し忘れていたときに型エラーを出す検出用コード
Expand Down
13 changes: 0 additions & 13 deletions src/store/singing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,6 @@ export const singingStoreState: SingingStoreState = {
editFrameRate: DEPRECATED_DEFAULT_EDIT_FRAME_RATE,
phrases: new Map(),
singingGuides: new Map(),
// NOTE: UIの状態は試行のためsinging.tsに局所化する+Hydrateが必要
isShowSinger: true,
sequencerZoomX: 0.5,
sequencerZoomY: 0.75,
sequencerSnapType: 16,
Expand All @@ -438,17 +436,6 @@ export const singingStoreState: SingingStoreState = {
};

export const singingStore = createPartialStore<SingingStoreTypes>({
SET_SHOW_SINGER: {
mutation(state, { isShowSinger }: { isShowSinger: boolean }) {
state.isShowSinger = isShowSinger;
},
async action({ mutations }, { isShowSinger }) {
mutations.SET_SHOW_SINGER({
isShowSinger,
});
},
},

SELECTED_TRACK_ID: {
getter(state) {
// Undo/Redoで消えている場合は最初のトラックを選択していることにする
Expand Down
7 changes: 0 additions & 7 deletions src/store/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -838,8 +838,6 @@ export type SingingStoreState = {
editFrameRate: number;
phrases: Map<PhraseSourceHash, Phrase>;
singingGuides: Map<SingingGuideSourceHash, SingingGuide>;
// NOTE: UIの状態などは分割・統合した方がよさそうだが、ボイス側と混在させないためいったん局所化する
isShowSinger: boolean;
sequencerZoomX: number;
sequencerZoomY: number;
sequencerSnapType: number;
Expand All @@ -857,11 +855,6 @@ export type SingingStoreState = {
};

export type SingingStoreTypes = {
SET_SHOW_SINGER: {
mutation: { isShowSinger: boolean };
action(payload: { isShowSinger: boolean }): void;
};

SELECTED_TRACK_ID: {
getter: TrackId;
};
Expand Down
1 change: 1 addition & 0 deletions src/type/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@ export const rootMiscSettingSchema = z.object({
panAndGain: z.boolean().default(true),
})
.default({}),
showSinger: z.boolean().default(true),
});
export type RootMiscSettingType = z.infer<typeof rootMiscSettingSchema>;

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ccba185

Please sign in to comment.