Mirror for Friday Night Funkin
at main 41 lines 1.3 kB view raw
1package funkin.ui.debug.charting.contextmenus; 2 3import haxe.ui.containers.menus.MenuItem; 4import funkin.data.song.SongData.SongNoteData; 5import funkin.ui.debug.charting.commands.FlipNotesCommand; 6import funkin.ui.debug.charting.commands.RemoveNotesCommand; 7import funkin.ui.debug.charting.commands.ExtendNoteLengthCommand; 8 9@:access(funkin.ui.debug.charting.ChartEditorState) 10@:build(haxe.ui.ComponentBuilder.build("assets/exclude/data/ui/chart-editor/context-menus/note.xml")) 11class ChartEditorNoteContextMenu extends ChartEditorBaseContextMenu 12{ 13 var contextmenuFlip:MenuItem; 14 var contextmenuDelete:MenuItem; 15 16 var data:SongNoteData; 17 18 public function new(chartEditorState2:ChartEditorState, xPos2:Float = 0, yPos2:Float = 0, data:SongNoteData) 19 { 20 super(chartEditorState2, xPos2, yPos2); 21 this.data = data; 22 23 initialize(); 24 } 25 26 function initialize():Void 27 { 28 // NOTE: Remember to use commands here to ensure undo/redo works properly 29 contextmenuFlip.onClick = function(_) { 30 chartEditorState.performCommand(new FlipNotesCommand([data])); 31 } 32 33 contextmenuAddHold.onClick = function(_) { 34 chartEditorState.performCommand(new ExtendNoteLengthCommand(data, 4, STEPS)); 35 } 36 37 contextmenuDelete.onClick = function(_) { 38 chartEditorState.performCommand(new RemoveNotesCommand([data])); 39 } 40 } 41}