Skip to content

Commit

Permalink
修正、コメントを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
sigprogramming committed Dec 23, 2023
1 parent 301a54c commit e947a03
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 1 addition & 5 deletions src/components/Sing/ScoreSequencer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -407,11 +407,7 @@ export default defineComponent({
}
const position = note.position + amountPositionX;
const noteNumber = note.noteNumber + amountPositionY;
editedNotes.push({
...note,
noteNumber,
position,
});
editedNotes.push({ ...note, noteNumber, position });
}
// 左端より前はドラッグしない
Expand Down
10 changes: 5 additions & 5 deletions src/store/singing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ class OverlappingNotesDetector {
overlappingNoteIds: new Set<string>(),
});
}

// TODO: 計算量がO(n^2)になっているので、区間木などを使用してO(nlogn)にする
for (const note of notes) {
const overlappingNoteIds = new Set<string>();
for (const [noteId, noteInfo] of this.noteInfos) {
Expand Down Expand Up @@ -325,7 +325,6 @@ class OverlappingNotesDetector {
noteInfo1.overlappingNoteIds.delete(noteId2);
}
}

for (const note of notes) {
this.noteInfos.delete(note.id);
}
Expand Down Expand Up @@ -727,7 +726,8 @@ export const singingStore = createPartialStore<SingingStoreTypes>({
) {
const scoreNotes = state.score.notes;
const existingIds = new Set(scoreNotes.map((value) => value.id));
if (!noteIds.every((value) => existingIds.has(value))) {
const isValidNoteIds = noteIds.every((value) => existingIds.has(value));
if (!isValidNoteIds) {
throw new Error("The note ids are invalid.");
}
commit("REMOVE_NOTES", { noteIds });
Expand Down Expand Up @@ -1082,7 +1082,7 @@ export const singingStore = createPartialStore<SingingStoreTypes>({
*/
RENDER: {
async action({ state, getters, commit, dispatch }) {
const removeOverlappingNotes = (
const deleteOverlappingNotes = (
score: Score,
overlappingNoteIds: string[]
) => {
Expand Down Expand Up @@ -1308,7 +1308,7 @@ export const singingStore = createPartialStore<SingingStoreTypes>({
const score = copyScore(state.score);
const singer = copySinger(state.singer);

removeOverlappingNotes(score, state.overlappingNoteIds);
deleteOverlappingNotes(score, state.overlappingNoteIds);

// Score -> Phrases

Expand Down

0 comments on commit e947a03

Please sign in to comment.