mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-12-25 14:46:43 +00:00
48 lines
1.3 KiB
Haxe
48 lines
1.3 KiB
Haxe
package funkin.ui.debug.charting.commands;
|
|
|
|
import funkin.data.song.SongData.SongNoteData;
|
|
import funkin.data.song.SongData.SongEventData;
|
|
|
|
/**
|
|
* Command that deselects all selected notes and events in the chart editor.
|
|
*/
|
|
@:nullSafety
|
|
@:access(funkin.ui.debug.charting.ChartEditorState)
|
|
class DeselectAllItemsCommand implements ChartEditorCommand
|
|
{
|
|
var previousNoteSelection:Array<SongNoteData> = [];
|
|
var previousEventSelection:Array<SongEventData> = [];
|
|
|
|
public function new() {}
|
|
|
|
public function execute(state:ChartEditorState):Void
|
|
{
|
|
this.previousNoteSelection = state.currentNoteSelection;
|
|
this.previousEventSelection = state.currentEventSelection;
|
|
|
|
state.currentNoteSelection = [];
|
|
state.currentEventSelection = [];
|
|
|
|
state.noteDisplayDirty = true;
|
|
}
|
|
|
|
public function undo(state:ChartEditorState):Void
|
|
{
|
|
state.currentNoteSelection = previousNoteSelection;
|
|
state.currentEventSelection = previousEventSelection;
|
|
|
|
state.noteDisplayDirty = true;
|
|
}
|
|
|
|
public function shouldAddToHistory(state:ChartEditorState):Bool
|
|
{
|
|
// This command is undoable. Add to the history if we actually performed an action.
|
|
return (previousNoteSelection.length > 0 || previousEventSelection.length > 0);
|
|
}
|
|
|
|
public function toString():String
|
|
{
|
|
return 'Deselect All Items';
|
|
}
|
|
}
|