From 6f141e5f52810ae1dcc062ba33d27a31d200cc6c Mon Sep 17 00:00:00 2001 From: Cameron Taylor Date: Fri, 8 Dec 2023 22:28:34 -0500 Subject: [PATCH] copy text popup --- .../ui/debug/charting/ChartEditorState.hx | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index 66effc775..b52ab10bc 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -114,6 +114,7 @@ import haxe.ui.events.UIEvent; import haxe.ui.events.UIEvent; import haxe.ui.focus.FocusManager; import openfl.display.BitmapData; +import flixel.text.FlxText; using Lambda; @@ -1618,6 +1619,11 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState */ var healthIconBF:Null = null; + /** + * The text that pop's up when copying something + */ + var txtCopyNotif:Null = null; + /** * The purple background sprite. */ @@ -2273,6 +2279,12 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState add(playbarHeadLayout); + txtCopyNotif = new FlxText(0, 0, 0, '', 24); + txtCopyNotif.setBorderStyle(OUTLINE, 0xFF074809, 1); + txtCopyNotif.color = 0xFF52FF77; + txtCopyNotif.zIndex = 120; + add(txtCopyNotif); + if (!Preferences.debugDisplay) menubar.paddingLeft = null; this.setupNotifications(); @@ -4444,7 +4456,22 @@ class ChartEditorState extends UIState // UIState derives from MusicBeatState // CTRL + C = Copy if (FlxG.keys.pressed.CONTROL && FlxG.keys.justPressed.C) { - // Copy selected notes. + if (currentNoteSelection.length > 0) + { + txtCopyNotif.visible = true; + txtCopyNotif.text = "Copied " + currentNoteSelection.length + " notes to clipboard"; + txtCopyNotif.x = FlxG.mouse.x - (txtCopyNotif.width / 2); + txtCopyNotif.y = FlxG.mouse.y - 16; + FlxTween.tween(txtCopyNotif, {y: txtCopyNotif.y - 32}, 0.5, + { + type: FlxTween.ONESHOT, + ease: FlxEase.quadOut, + onComplete: function(_) { + txtCopyNotif.visible = false; + } + }); + } + // We don't need a command for this since we can't undo it. SongDataUtils.writeItemsToClipboard( {