Better method name and remove unnecessary variable

This commit is contained in:
Hyper_ 2024-10-07 16:10:19 -03:00 committed by Hyper_
parent 254b9e1797
commit c9dea7c6a0
2 changed files with 4 additions and 7 deletions

View file

@ -43,11 +43,10 @@ class PasteItemsCommand implements ChartEditorCommand
addedEvents = SongDataUtils.offsetSongEventData(currentClipboard.events, Std.int(targetTimestamp));
addedEvents = SongDataUtils.clampSongEventData(addedEvents, 0.0, msCutoff);
var shouldWarn = false;
var curAddedNotesLen = addedNotes.length;
// TODO: Should events also not be allowed to stack?
state.currentSongChartNoteData = state.currentSongChartNoteData.concatFilterStackedNotes(addedNotes, ChartEditorState.STACK_NOTE_THRESHOLD, true);
state.currentSongChartNoteData = state.currentSongChartNoteData.concatNoOverlap(addedNotes, ChartEditorState.STACK_NOTE_THRESHOLD, true);
state.currentSongChartEventData = state.currentSongChartEventData.concat(addedEvents);
state.currentNoteSelection = addedNotes.copy();
state.currentEventSelection = addedEvents.copy();
@ -58,8 +57,7 @@ class PasteItemsCommand implements ChartEditorCommand
state.sortChartData();
shouldWarn = curAddedNotesLen != addedNotes.length;
if (shouldWarn) state.warning('Failed to Paste All Notes', 'Some notes couldn\'t be pasted because they overlapped others.');
if (curAddedNotesLen != addedNotes.length) state.warning('Failed to Paste All Notes', 'Some notes couldn\'t be pasted because they would overlap others.');
else
state.success('Paste Successful', 'Successfully pasted clipboard contents.');
}

View file

@ -71,13 +71,12 @@ class NoteDataFilter
/**
* Tries to concatenate two arrays of notes together but skips notes from `notesB` that overlap notes from `noteA`.
* @param notesA An array of notes into which `notesB` will be concatenated.
* @param notesB Another array of notes that will be concated into `input`.
* @param notesB Another array of notes that will be concated into `notesA`.
* @param threshold Threshold in ms
* @param modifyB If `true` `notesB` will be modified in-place by removing the notes that overlap notes from `notesA`.
* @return Array<SongNoteData>
*/
public static function concatFilterStackedNotes(notesA:Array<SongNoteData>, notesB:Array<SongNoteData>, threshold:Float,
modifyB:Bool = false):Array<SongNoteData>
public static function concatNoOverlap(notesA:Array<SongNoteData>, notesB:Array<SongNoteData>, threshold:Float, modifyB:Bool = false):Array<SongNoteData>
{
// TODO: Maybe this whole function should be moved to SongNoteDataArrayTools
var result:Array<SongNoteData> = notesA.copy();