mirror of
https://github.com/ninjamuffin99/Funkin.git
synced 2024-11-04 13:54:22 +00:00
Copy command now pulses events in selection even if no notes are in the selection. "Copied" prompt now includes events in the text.
This commit is contained in:
parent
d039c20eef
commit
7137c13382
|
@ -153,8 +153,8 @@ class SongDataUtils
|
|||
public static function buildNoteClipboard(notes:Array<SongNoteData>, ?timeOffset:Int = null):Array<SongNoteData>
|
||||
{
|
||||
if (notes.length == 0) return notes;
|
||||
if (timeOffset == null) timeOffset = -Std.int(notes[0].time);
|
||||
return offsetSongNoteData(sortNotes(notes), timeOffset);
|
||||
if (timeOffset == null) timeOffset = Std.int(notes[0].time);
|
||||
return offsetSongNoteData(sortNotes(notes), -timeOffset);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -165,8 +165,8 @@ class SongDataUtils
|
|||
public static function buildEventClipboard(events:Array<SongEventData>, ?timeOffset:Int = null):Array<SongEventData>
|
||||
{
|
||||
if (events.length == 0) return events;
|
||||
if (timeOffset == null) timeOffset = -Std.int(events[0].time);
|
||||
return offsetSongEventData(sortEvents(events), timeOffset);
|
||||
if (timeOffset == null) timeOffset = Std.int(events[0].time);
|
||||
return offsetSongEventData(sortEvents(events), -timeOffset);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -46,26 +46,14 @@ class CopyItemsCommand implements ChartEditorCommand
|
|||
|
||||
function performVisuals(state:ChartEditorState):Void
|
||||
{
|
||||
var hasNotes:Bool = false;
|
||||
var hasEvents:Bool = false;
|
||||
|
||||
// Wiggle copied notes.
|
||||
if (state.currentNoteSelection.length > 0)
|
||||
{
|
||||
// Display the "Copied Notes" text.
|
||||
if (state.txtCopyNotif != null)
|
||||
{
|
||||
state.txtCopyNotif.visible = true;
|
||||
state.txtCopyNotif.text = "Copied " + state.currentNoteSelection.length + " notes to clipboard";
|
||||
state.txtCopyNotif.x = FlxG.mouse.x - (state.txtCopyNotif.width / 2);
|
||||
state.txtCopyNotif.y = FlxG.mouse.y - 16;
|
||||
FlxTween.tween(state.txtCopyNotif, {y: state.txtCopyNotif.y - 32}, 0.5,
|
||||
{
|
||||
type: FlxTween.ONESHOT,
|
||||
ease: FlxEase.quadOut,
|
||||
onComplete: function(_) {
|
||||
state.txtCopyNotif.visible = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
hasNotes = true;
|
||||
|
||||
// Wiggle the notes.
|
||||
for (note in state.renderedNotes.members)
|
||||
{
|
||||
if (state.isNoteSelected(note.noteData))
|
||||
|
@ -91,8 +79,13 @@ class CopyItemsCommand implements ChartEditorCommand
|
|||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Wiggle copied events.
|
||||
if (state.currentEventSelection.length > 0)
|
||||
{
|
||||
hasEvents = true;
|
||||
|
||||
// Wiggle the events.
|
||||
for (event in state.renderedEvents.members)
|
||||
{
|
||||
if (state.isEventSelected(event.eventData))
|
||||
|
@ -119,6 +112,39 @@ class CopyItemsCommand implements ChartEditorCommand
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Display the "Copied Notes" text.
|
||||
if ((hasNotes || hasEvents) && state.txtCopyNotif != null)
|
||||
{
|
||||
var copiedString:String = '';
|
||||
if (hasNotes)
|
||||
{
|
||||
var copiedNotes:Int = state.currentNoteSelection.length;
|
||||
copiedString += '${copiedNotes} note';
|
||||
if (copiedNotes > 1) copiedString += 's';
|
||||
|
||||
if (hasEvents) copiedString += ' and ';
|
||||
}
|
||||
if (hasEvents)
|
||||
{
|
||||
var copiedEvents:Int = state.currentEventSelection.length;
|
||||
copiedString += '${state.currentEventSelection.length} event';
|
||||
if (copiedEvents > 1) copiedString += 's';
|
||||
}
|
||||
|
||||
state.txtCopyNotif.visible = true;
|
||||
state.txtCopyNotif.text = 'Copied ${copiedString} to clipboard';
|
||||
state.txtCopyNotif.x = FlxG.mouse.x - (state.txtCopyNotif.width / 2);
|
||||
state.txtCopyNotif.y = FlxG.mouse.y - 16;
|
||||
FlxTween.tween(state.txtCopyNotif, {y: state.txtCopyNotif.y - 32}, 0.5,
|
||||
{
|
||||
type: FlxTween.ONESHOT,
|
||||
ease: FlxEase.quadOut,
|
||||
onComplete: function(_) {
|
||||
state.txtCopyNotif.visible = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function undo(state:ChartEditorState):Void
|
||||
|
|
Loading…
Reference in a new issue