-
Notifications
You must be signed in to change notification settings - Fork 345
[project-s] 重なっているノートを検出して色を変えて表示する機能を追加 #1676
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
[project-s] 重なっているノートを検出して色を変えて表示する機能を追加 #1676
Conversation
Hiroshiba
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!!
dev環境じゃない状態で起動する方法を調べてみました。
いろいろややこしいので実際にビルドしちゃうのが手っ取り早そうでした!
ビルドコマンド↓
npm run electron:build -- --dirビルド完了後はdist_electron/win-unpacked/VOICEVOX.exeができてるはずです。
エンジンが同梱されないので、実行するとエンジン起動エラーが表示されると思います。
別でエンジンrun.exeを起動してあげればUIが表示されるかなと!
(ただ製品のVOICEVOXと同じconfigファイルを見るので、configの状況によっては正しく表示されないかもです)
| }); | ||
| const selectedNoteIds = computed(() => state.selectedNoteIds); | ||
| const selectedNotes = computed(() => { | ||
| const selectedNoteIds = new Set(state.selectedNoteIds); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
selectedNoteIdsはもともと`Setにしておいても良いかもですね!
| const classNamesStr = computed(() => { | ||
| if (state.selectedNoteIds.includes(props.note.id)) { | ||
| return "sequencer-note selected"; | ||
| } | ||
| if (state.overlappingNoteIds.includes(props.note.id)) { | ||
| return "sequencer-note overlapping"; | ||
| } | ||
| return "sequencer-note"; | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
文字列の配列を返してもいけるかも・・・?
https://ja.vuejs.org/guide/essentials/class-and-style#binding-to-arrays
つまりこんな感じも。(sequencer-noteのコピペを抑えられる)
const classes = ["sequencer-note"]
if(selected) { classes.push("selected") }
else if(overlapped) { classes.push("overlapping") }
return classes| const scoreNotes = state.score.notes; | ||
| const existingIds = new Set(scoreNotes.map((value) => value.id)); | ||
| const isValidNoteIds = noteIds.every((value) => existingIds.has(value)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
この処理結構見かけるのでGETTER辺りに置いても良いかもと思いました!
内容
重なっているノートを検出して色を変えて表示する機能を追加します。
また、以下も行います。
ADD_NOTEからADD_NOTESに変更(複数ノートに対応)UPDATE_NOTEからUPDATE_NOTESに変更(複数ノートに対応)REPLACE_ALL_NOTESを削除REMOVE_NOTEからREMOVE_NOTESに変更(複数ノートに対応)SET_SELECTED_NOTE_IDSのactionを削除SELECT_NOTESを追加CLEAR_SELECTED_NOTE_IDSからDESELECT_ALL_NOTESに変更REMOVE_SELECTED_NOTESのmutationを削除(REMOVE_NOTESを呼び出すように変更)REPLACE_ALL_NOTESを削除したので、それに合わせてドラッグ周りの処理を修正state.overlappingNoteIdsを元に削除するように変更重なっているノートを検出する処理は計算量が$O(n^2)$ になっています。
関連 Issue
VOICEVOX/voicevox_project#15
その他