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; var events:Array; public function new(notes:Array, events:Array) { 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'; } }