From 0be6de9691faec46a816d5686a9e4b5b54a956cc Mon Sep 17 00:00:00 2001 From: Nanashi Date: Wed, 17 Apr 2024 23:24:21 +0900 Subject: [PATCH] =?UTF-8?q?=E3=82=BD=E3=83=B3=E3=82=B0=EF=BC=9A=E6=AD=8C?= =?UTF-8?q?=E8=A9=9E=E3=81=AE=E4=B8=80=E6=8B=AC=E5=85=A5=E5=8A=9B=E3=82=92?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=20(#1952)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * WIP * Add: 実装 * Add: テストを追加 * Change: splitMorasAndNonMoras -> splitLyricsByMoras Co-Authored-By: Hiroshiba * Change: with-preview-lyric -> preview-lyric Co-Authored-By: Hiroshiba * Code: 参考を追加 * Refactor: splitLyricsByMorasを読みやすく * Refactor: もう少し詳しく * Add: テストケースを追加 Co-Authored-By: Hiroshiba * Change: lyricUpdated -> lyricUpdate Co-Authored-By: Hiroshiba * Code: lyric周りのコメントを追加 Co-Authored-By: Hiroshiba * Code: ScoreSequencerにコメントを追加 * Refactor: useLyricInputに切り出し * Add: TODOコメントを追加 * Code: 日本語を修正 * Change: !! -> != undefiend Co-Authored-By: Hiroshiba * Change: displayedLyric -> lyricToDisplay * Change: lyricUpdate -> lyric-input * Change: 良い感じの名前に * Code: 可読性を向上 * Improve: ひらがな/カタカナを保持するように * Fix: 長いときの表示を修正 * Code: ドキュメントを追加 * Refactor: v-elseにまとめる * Refactor: splitLyricsByMorasをリファクタ * いくつか更新 * fmt --------- Co-authored-by: Hiroshiba Co-authored-by: Hiroshiba --- src/components/Sing/ScoreSequencer.vue | 20 ++++++++ src/components/Sing/SequencerNote.vue | 62 +++++++++++++++-------- src/composables/useLyricInput.ts | 57 +++++++++++++++++++++ src/sing/domain.ts | 59 +++++++++++++++++++++ src/store/utility.ts | 9 +++- tests/unit/lib/splitLyricsByMoras.spec.ts | 49 ++++++++++++++++++ 6 files changed, 235 insertions(+), 21 deletions(-) create mode 100644 src/composables/useLyricInput.ts create mode 100644 tests/unit/lib/splitLyricsByMoras.spec.ts diff --git a/src/components/Sing/ScoreSequencer.vue b/src/components/Sing/ScoreSequencer.vue index e9d54f98e3..006977035b 100644 --- a/src/components/Sing/ScoreSequencer.vue +++ b/src/components/Sing/ScoreSequencer.vue @@ -110,25 +110,32 @@ }" > + (null); const cursorX = ref(0); const cursorY = ref(0); +// 歌詞入力 +const { previewLyrics, commitPreviewLyrics, splitAndUpdatePreview } = + useLyricInput(); + +const onNoteLyricInput = (text: string, note: Note) => { + splitAndUpdatePreview(text, note); +}; + +const onNoteLyricBlur = () => { + commitPreviewLyrics(); +}; + // プレビュー // FIXME: 関連する値を1つのobjectにまとめる const nowPreviewing = ref(false); diff --git a/src/components/Sing/SequencerNote.vue b/src/components/Sing/SequencerNote.vue index 1ee9a2bd48..6467bc9289 100644 --- a/src/components/Sing/SequencerNote.vue +++ b/src/components/Sing/SequencerNote.vue @@ -3,6 +3,7 @@ class="note" :class="{ selected: noteState === 'SELECTED', + 'preview-lyric': props.previewLyric != undefined, overlapping: hasOverlappingError, 'invalid-phrase': hasPhraseError, 'below-pitch': showPitch, @@ -19,24 +20,25 @@ -
- {{ lyric }} -