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

Add: BPM・拍子変更機能を追加 #2303

Open
wants to merge 113 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
113 commits
Select commit Hold shift + click to select a range
b053319
Add: 右クリックメニューを追加
sevenc-nanashi Oct 17, 2024
f548b90
Add: ダイアログを仮置き
sevenc-nanashi Oct 18, 2024
98bfb09
Add: ある程度Storyを追加
sevenc-nanashi Oct 18, 2024
7926faf
Delete: 未使用のimportを削除
sevenc-nanashi Oct 18, 2024
cb2d29e
Add: 削除周りの制御を追加
sevenc-nanashi Oct 18, 2024
4566a67
Add: ルーラーの表示を追加
sevenc-nanashi Oct 18, 2024
d861b88
Add: ルーラーの表示をクリックできるように
sevenc-nanashi Oct 18, 2024
29b5bfa
Add: ツールバーで設定出来るように
sevenc-nanashi Oct 18, 2024
6bd2460
Add: SequencerGridを複数拍子に対応
sevenc-nanashi Oct 19, 2024
ae30925
Add: SequencerRulerを複数拍子に対応
sevenc-nanashi Oct 19, 2024
5d50cb9
Refactor: Container/Presentationに分離
sevenc-nanashi Oct 19, 2024
a2c2d57
Add: Storyを追加
sevenc-nanashi Oct 19, 2024
8d88b6e
Change: uiLockedをpropsで渡せるようにする
sevenc-nanashi Oct 19, 2024
756971a
Add: テストの痕跡を追加
sevenc-nanashi Oct 19, 2024
b4d703e
Refactor: SequencerGridをContainer/Presentationに分離
sevenc-nanashi Oct 19, 2024
9131b71
Add: SequencerGridのStoryを追加
sevenc-nanashi Oct 19, 2024
baeb8b2
Delete: 複数拍子に対応したので削除
sevenc-nanashi Oct 19, 2024
e0d3090
Fix: パスを修正
sevenc-nanashi Oct 19, 2024
d5da914
Add: Storyを追加
sevenc-nanashi Oct 19, 2024
b0ce215
Change: 縦方向に制限する
sevenc-nanashi Oct 19, 2024
dce8a41
Merge: upstream/main -> add/multiple-bpm
sevenc-nanashi Oct 19, 2024
25e694f
[update snapshots]
sevenc-nanashi Oct 19, 2024
74e95b9
(スナップショットを更新)
github-actions[bot] Oct 19, 2024
7458135
Delete: 異物混入を消す
sevenc-nanashi Oct 19, 2024
7d5df06
Delete: デバッグの残骸を削除
sevenc-nanashi Oct 20, 2024
0d56fa9
Merge: upstream/main -> add/multiple-bpm
sevenc-nanashi Oct 20, 2024
9c2e259
Update: スナップショットを更新
sevenc-nanashi Oct 20, 2024
99c1cb4
(スナップショットを更新)
github-actions[bot] Oct 20, 2024
5197afa
Merge: main -> add/multiple-bpm
sevenc-nanashi Oct 26, 2024
97b0685
Change: ContextMenuをDIする
sevenc-nanashi Oct 26, 2024
efa1580
[update snapshots]
sevenc-nanashi Oct 26, 2024
a10557d
Fix: skip-screenshotをつける
sevenc-nanashi Oct 26, 2024
d9c51bd
(スナップショットを更新)
github-actions[bot] Oct 26, 2024
a8da727
Merge: main -> add/multiple-bpm
sevenc-nanashi Oct 29, 2024
2207396
Merge: origin/add/multiple-bpm -> add/multiple-bpm
sevenc-nanashi Oct 29, 2024
5709fd1
Fix: playheadPosition -> playheadTicks
sevenc-nanashi Oct 29, 2024
3f47c2a
Change: Dot記法にする
sevenc-nanashi Oct 29, 2024
33c3b6a
Fix: スナップ線が出ていなかったのを修正
sevenc-nanashi Oct 29, 2024
3237f60
Fix: Storybookが壊れてたのを修正
sevenc-nanashi Oct 29, 2024
512f7b3
Add: snapTypeを指定
sevenc-nanashi Oct 29, 2024
e1f1b76
Change: フォーマットを変える
sevenc-nanashi Oct 29, 2024
c94506f
Change: gridPatternsに色々入れる
sevenc-nanashi Oct 29, 2024
28c7429
Change: atを使う
sevenc-nanashi Oct 29, 2024
ae32da6
Change: tickToMeasureNumberを使う
sevenc-nanashi Oct 29, 2024
bd6e125
Change: patternの計算を修正
sevenc-nanashi Oct 29, 2024
a342a17
Improve: Ruler側も良い感じにする
sevenc-nanashi Oct 30, 2024
24eea03
Change: measureWidthにする
sevenc-nanashi Oct 30, 2024
4798205
Fix: deepを外す
sevenc-nanashi Oct 30, 2024
26a910e
Delete: beatsPerMeasure()を削除
sevenc-nanashi Oct 30, 2024
e2ca101
Refactor: 書き方を変える
sevenc-nanashi Oct 31, 2024
c81cd59
Code: last -> current
sevenc-nanashi Oct 31, 2024
1260cc0
Delete: ヘッダーを消す
sevenc-nanashi Oct 31, 2024
4193ba3
Change: externally taggedにする
sevenc-nanashi Oct 31, 2024
9ff6b8e
Change: テンポ/拍子のダイアログを分ける
sevenc-nanashi Nov 3, 2024
4a432db
Fix: 使われてないスナップショットを削除するように
sevenc-nanashi Nov 3, 2024
d2dd39a
(スナップショットを更新)
github-actions[bot] Nov 3, 2024
0328e53
Fix: 削除できるように
sevenc-nanashi Nov 3, 2024
8e37449
Fix: Linterの怒られを修正
sevenc-nanashi Nov 3, 2024
1aacc8e
Change: findを使う
sevenc-nanashi Nov 3, 2024
3bc6e06
Add: 良い感じにたたむように
sevenc-nanashi Nov 3, 2024
9a88f33
Code: コメントを追加
sevenc-nanashi Nov 3, 2024
746a759
Change: スナップ線の位置を変える
sevenc-nanashi Nov 4, 2024
41ec1ea
Improve: BPMのツールチップの表示を変える
sevenc-nanashi Nov 4, 2024
1a0d7bb
Add: BPM/拍子のヘッダーを追加
sevenc-nanashi Nov 4, 2024
4d740ad
Merge: upstream/main -> add/multiple-bpm
sevenc-nanashi Nov 7, 2024
3583f01
Fix: tempoChangeの指定を修正
sevenc-nanashi Nov 13, 2024
3ba5267
Change: item !== falseで判別するように
sevenc-nanashi Nov 13, 2024
da37160
Code: prettierにしたがう
sevenc-nanashi Nov 13, 2024
4a7eff5
Fix: soft tabにする
sevenc-nanashi Nov 13, 2024
1b44bb0
Change: BPM -> テンポ
sevenc-nanashi Nov 13, 2024
c1c62d1
Code: フォーマット
sevenc-nanashi Nov 13, 2024
8a88804
Delete: 不要なWorkaroundを削除
sevenc-nanashi Nov 13, 2024
dccac33
(スナップショットを更新)
github-actions[bot] Nov 13, 2024
696dd50
Change: テキストのスタイルを取得する
sevenc-nanashi Nov 14, 2024
969932f
Add: フォールバックを追加
sevenc-nanashi Nov 15, 2024
197590e
Fix: ESLintを無効化する
sevenc-nanashi Nov 15, 2024
6401377
Merge: upstream/main -> add/multiple-bpm
sevenc-nanashi Nov 15, 2024
322886c
Fix: ロガーが反転してるのを直す
sevenc-nanashi Nov 15, 2024
5003b30
Improve: キャッシュを追加
sevenc-nanashi Nov 16, 2024
48282a9
Codd: undefinedチェックということを明示
sevenc-nanashi Nov 17, 2024
f5ceae7
Merge branch 'main' into add/multiple-bpm
sevenc-nanashi Nov 17, 2024
808260a
Update: ロックファイルを更新
sevenc-nanashi Nov 17, 2024
e95a8ee
Merge: main -> add/multiple-bpm
sevenc-nanashi Nov 19, 2024
aae9a55
Code: 細かい整理
sevenc-nanashi Nov 21, 2024
c62e263
Merge: upstream/main -> add/multiple-bpm
sevenc-nanashi Nov 21, 2024
6441c05
Refactor: useSequencerGridに切り出し
sevenc-nanashi Nov 21, 2024
23a32e1
Change: ズームのControlをrangeにする
sevenc-nanashi Nov 21, 2024
5629018
[update snapshots]
sevenc-nanashi Nov 21, 2024
6358093
(スナップショットを更新)
github-actions[bot] Nov 21, 2024
27bfe0e
Delete: 使ってなかった残骸を削除
sevenc-nanashi Nov 21, 2024
dc08dc1
Change: ダイアログを小さく
sevenc-nanashi Nov 21, 2024
9ea16a7
Change: QInputにする
sevenc-nanashi Nov 21, 2024
a362f3a
Code: 不要なimportを消す
sevenc-nanashi Nov 21, 2024
339d025
Code: 不要なcomputedを削除
sevenc-nanashi Nov 21, 2024
401b9f2
[updatesn apshots]
sevenc-nanashi Nov 21, 2024
30d4425
[update snapshots]
sevenc-nanashi Nov 21, 2024
9414e41
(スナップショットを更新)
github-actions[bot] Nov 21, 2024
61055ca
Merge: main -> add/multiple-bpm
sevenc-nanashi Nov 23, 2024
fbc6783
Change: slotを使わないようにする
sevenc-nanashi Nov 23, 2024
b8ba733
Fix: slotsを消す
sevenc-nanashi Nov 24, 2024
646d82d
Delete: 使ってないimportを消す
sevenc-nanashi Nov 24, 2024
256a4a9
Code: TempoOrTimeSignatureChange -> ValueChange
sevenc-nanashi Nov 25, 2024
56c483f
Update: スナップショットを更新
sevenc-nanashi Nov 25, 2024
2a5126f
(スナップショットを更新)
github-actions[bot] Nov 25, 2024
ae63e1e
Code: TextWidthCacheKeyをbranded stringにする
sevenc-nanashi Nov 25, 2024
19fd5cf
Delete: ホバー周りを一旦消す
sevenc-nanashi Nov 27, 2024
cd6ae0c
Fix: titleを直す
sevenc-nanashi Nov 27, 2024
ab3438a
Merge: upstream/main -> add/multiple-bpm
sevenc-nanashi Nov 27, 2024
c22b92b
Delete: 使ってないダイアログ周りの画像を消す
sevenc-nanashi Nov 27, 2024
571b51f
Code: beatWidthをprivateにする
sevenc-nanashi Nov 27, 2024
c86387e
Code: getSnappedTickFromOffsetXに切り出す
sevenc-nanashi Nov 27, 2024
3a91677
Fix: キャンセルボタンの色を直す
sevenc-nanashi Nov 27, 2024
7f3ce9a
(スナップショットを更新)
github-actions[bot] Nov 27, 2024
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
10 changes: 9 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@
"vite-plugin-electron": "0.29.0",
"vite-tsconfig-paths": "5.1.2",
"vitest": "2.1.2",
"vue-component-type-helpers": "2.1.6",
"vue-tsc": "2.1.10",
"yargs": "17.2.1"
}
Expand Down
3 changes: 3 additions & 0 deletions src/components/Menu/ContextMenu/Presentation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ defineProps<{
uiLocked?: boolean;
}>();
defineExpose({
show: (event?: MouseEvent | undefined) => {
contextMenu.value?.show(event);
},
hide: () => {
contextMenu.value?.hide();
},
Expand Down
91 changes: 91 additions & 0 deletions src/components/Sing/ChangeValueDialog/CommonDialog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<!--
テンポや拍子などを変更・追加するためのダイアログ
-->
<template>
sevenc-nanashi marked this conversation as resolved.
Show resolved Hide resolved
<QDialog ref="dialogRef" v-model="modelValue">
<QCard class="q-py-sm q-px-md dialog-card">
<QCardSection>
<div class="text-h5">
{{ props.title }}
</div>
</QCardSection>

<QSeparator />

<QCardSection>
<QCardActions>
<div>{{ props.name }}</div>
<QSpace />
<slot />
</QCardActions>
</QCardSection>

<QSeparator />

<QCardActions>
<QSpace />
<QBtn
unelevated
label="キャンセル"
color="surface"
textColor="display"
class="text-no-wrap text-bold q-mr-sm"
@click="handleCancel"
/>
<QBtn
unelevated
:label="okText"
color="primary"
textColor="display-on-primary"
class="text-no-wrap text-bold q-mr-sm"
@click="handleOk"
/>
</QCardActions>
</QCard>
</QDialog>
</template>

<script setup lang="ts">
import { useDialogPluginComponent } from "quasar";
import { computed } from "vue";

const { dialogRef, onDialogOK, onDialogCancel } = useDialogPluginComponent();

const modelValue = defineModel<boolean>();
const props = defineProps<{
title: string;
mode: "add" | "edit";
name: string;
}>();
defineSlots<{
default(props: Record<string, never>): void;
}>();

defineEmits({
...useDialogPluginComponent.emitsObject,
});

const okText = computed(() =>
props.mode === "edit" ? "変更する" : "追加する",
);

const handleOk = () => {
onDialogOK();
};

const handleCancel = () => {
onDialogCancel();
modelValue.value = false;
};
</script>

<style scoped lang="scss">
.dialog-card {
width: 400px;
max-width: 40vw;
}

.value-input {
width: 60px;
}
</style>
101 changes: 101 additions & 0 deletions src/components/Sing/ChangeValueDialog/TempoChangeDialog.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import { userEvent, within, expect, fn } from "@storybook/test";
import { Meta, StoryObj } from "@storybook/vue3";

import TempoChangeDialog from "./TempoChangeDialog.vue";

const meta: Meta<typeof TempoChangeDialog> = {
component: TempoChangeDialog,
args: {
modelValue: true,
tempoChange: undefined,
mode: "add",

onOk: fn(),
onHide: fn(),
},
tags: ["!autodocs"], // ダイアログ系はautodocsのプレビューが正しく表示されないので無効化
};

export default meta;
type Story = StoryObj<typeof meta>;

export const CreateOpened: Story = {
name: "開いている:追加",
args: {
modelValue: true,
mode: "add",
},
};
export const ChangeOpened: Story = {
name: "開いている:変更",
args: {
modelValue: true,
tempoChange: {
bpm: 120,
},
mode: "edit",
},
};

export const ClickOk: Story = {
name: "OKボタンを押す:追加",
args: { ...CreateOpened.args },
play: async ({ args }) => {
const canvas = within(document.body); // ダイアログなので例外的にdocument.bodyを使う

const input = canvas.getByLabelText("テンポ");
await userEvent.clear(input);
await userEvent.type(input, "100");

const button = canvas.getByRole("button", { name: /追加する/ });
await userEvent.click(button);

await expect(args["onOk"]).toBeCalledWith({
tempoChange: {
bpm: 100,
},
});
},
};

export const ClickDelete: Story = {
name: "OKボタンを押す:編集",
args: { ...ChangeOpened.args },
play: async ({ args }) => {
const canvas = within(document.body); // ダイアログなので例外的にdocument.bodyを使う

const input = canvas.getByLabelText("テンポ");
await userEvent.clear(input);
await userEvent.type(input, "100");

const button = canvas.getByRole("button", { name: /変更する/ });
await userEvent.click(button);

await expect(args["onOk"]).toBeCalledWith({
tempoChange: {
bpm: 100,
},
});
},
};

export const CancelClose: Story = {
name: "キャンセルボタンを押す",
args: { ...ChangeOpened.args },
play: async ({ args }) => {
const canvas = within(document.body); // ダイアログなので例外的にdocument.bodyを使う

const button = canvas.getByRole("button", { name: /キャンセル/ });
await userEvent.click(button);

await expect(args["onOk"]).not.toBeCalled();
},
};

export const Closed: Story = {
name: "閉じている",
tags: ["skip-screenshot"],
args: {
modelValue: false,
},
};
49 changes: 49 additions & 0 deletions src/components/Sing/ChangeValueDialog/TempoChangeDialog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<template>
<CommonDialog
v-model="modelValue"
:title="props.mode === 'add' ? 'テンポの追加' : 'テンポの編集'"
name="テンポ"
:mode="props.mode"
@ok="() => $emit('ok', { tempoChange })"
@hide="() => $emit('hide')"
>
<QInput
v-model.number="tempoChange.bpm"
type="number"
dense
hideBottomSpace
class="value-input"
aria-label="テンポ"
/>
</CommonDialog>
</template>

<script setup lang="ts">
import { QInput, useDialogPluginComponent } from "quasar";
import { ref } from "vue";
import CommonDialog from "./CommonDialog.vue";
import { Tempo } from "@/store/type";
import { DEFAULT_BPM } from "@/sing/domain";
import { cloneWithUnwrapProxy } from "@/helpers/cloneWithUnwrapProxy";

const modelValue = defineModel<boolean>();
const props = defineProps<{
tempoChange: Omit<Tempo, "position"> | undefined;
mode: "add" | "edit";
}>();
defineEmits({
...useDialogPluginComponent.emitsObject,
});

const tempoChange = ref(
cloneWithUnwrapProxy(props.tempoChange) || {
bpm: DEFAULT_BPM,
},
);
</script>

<style scoped lang="scss">
.value-input {
width: 60px;
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
import { userEvent, within, expect, fn } from "@storybook/test";
import { Meta, StoryObj } from "@storybook/vue3";

import TimeSignatureChangeDialog from "./TimeSignatureChangeDialog.vue";

const meta: Meta<typeof TimeSignatureChangeDialog> = {
component: TimeSignatureChangeDialog,
args: {
modelValue: true,
timeSignatureChange: undefined,
mode: "add",

onOk: fn(),
onHide: fn(),
},
tags: ["!autodocs"], // ダイアログ系はautodocsのプレビューが正しく表示されないので無効化
};

export default meta;
type Story = StoryObj<typeof meta>;

export const CreateOpened: Story = {
name: "開いている:追加",
args: {
modelValue: true,
mode: "add",
},
};
export const ChangeOpened: Story = {
name: "開いている:変更",
args: {
modelValue: true,
timeSignatureChange: {
beats: 4,
beatType: 4,
},
mode: "edit",
},
};

export const ClickOk: Story = {
name: "OKボタンを押す:追加",
args: { ...CreateOpened.args },
play: async ({ args }) => {
const canvas = within(document.body); // ダイアログなので例外的にdocument.bodyを使う

const input = canvas.getByLabelText("拍子の分子");
await userEvent.clear(input);
await userEvent.type(input, "3");

const button = canvas.getByRole("button", { name: /追加する/ });
await userEvent.click(button);

await expect(args["onOk"]).toBeCalledWith({
timeSignatureChange: {
beats: 3,
beatType: 4,
},
});
},
};

export const ClickDelete: Story = {
name: "OKボタンを押す:編集",
args: { ...ChangeOpened.args },
play: async ({ args }) => {
const canvas = within(document.body); // ダイアログなので例外的にdocument.bodyを使う

const input = canvas.getByLabelText("拍子の分子");
await userEvent.clear(input);
await userEvent.type(input, "6");

const button = canvas.getByRole("button", { name: /変更する/ });
await userEvent.click(button);

await expect(args["onOk"]).toBeCalledWith({
timeSignatureChange: {
beats: 6,
beatType: 4,
},
});
},
};

export const CancelClose: Story = {
name: "キャンセルボタンを押す",
args: { ...ChangeOpened.args },
play: async ({ args }) => {
const canvas = within(document.body); // ダイアログなので例外的にdocument.bodyを使う

const button = canvas.getByRole("button", { name: /キャンセル/ });
await userEvent.click(button);

await expect(args["onOk"]).not.toBeCalled();
},
};

export const Closed: Story = {
name: "閉じている",
tags: ["skip-screenshot"],
args: {
modelValue: false,
},
};
Loading
Loading