mirror of
https://github.com/FunkinCrew/Funkin.git
synced 2024-11-27 18:15:38 -05:00
61 lines
1.5 KiB
Haxe
61 lines
1.5 KiB
Haxe
|
package funkin.ui.debug.charting.commands;
|
||
|
|
||
|
import funkin.data.song.SongData.SongNoteData;
|
||
|
import funkin.data.song.SongData.SongEventData;
|
||
|
import funkin.data.song.SongDataUtils;
|
||
|
|
||
|
/**
|
||
|
* Command to deselect a specific set of notes and events in the chart editor.
|
||
|
*/
|
||
|
@:nullSafety
|
||
|
@:access(funkin.ui.debug.charting.ChartEditorState)
|
||
|
class DeselectItemsCommand implements ChartEditorCommand
|
||
|
{
|
||
|
var notes:Array<SongNoteData>;
|
||
|
var events:Array<SongEventData>;
|
||
|
|
||
|
public function new(notes:Array<SongNoteData>, events:Array<SongEventData>)
|
||
|
{
|
||
|
this.notes = notes;
|
||
|
this.events = events;
|
||
|
}
|
||
|
|
||
|
public function execute(state:ChartEditorState):Void
|
||
|
{
|
||
|
state.currentNoteSelection = SongDataUtils.subtractNotes(state.currentNoteSelection, this.notes);
|
||
|
state.currentEventSelection = SongDataUtils.subtractEvents(state.currentEventSelection, this.events);
|
||
|
|
||
|
state.noteDisplayDirty = true;
|
||
|
state.notePreviewDirty = true;
|
||
|
}
|
||
|
|
||
|
public function undo(state:ChartEditorState):Void
|
||
|
{
|
||
|
for (note in this.notes)
|
||
|
{
|
||
|
state.currentNoteSelection.push(note);
|
||
|
}
|
||
|
|
||
|
for (event in this.events)
|
||
|
{
|
||
|
state.currentEventSelection.push(event);
|
||
|
}
|
||
|
|
||
|
state.noteDisplayDirty = true;
|
||
|
state.notePreviewDirty = true;
|
||
|
}
|
||
|
|
||
|
public function toString():String
|
||
|
{
|
||
|
var noteCount = notes.length + events.length;
|
||
|
|
||
|
if (noteCount == 1)
|
||
|
{
|
||
|
var dir:String = notes[0].getDirectionName();
|
||
|
return 'Deselect $dir Items';
|
||
|
}
|
||
|
|
||
|
return 'Deselect ${noteCount} Items';
|
||
|
}
|
||
|
}
|