Click and drag on a sustain to edit it.

This commit is contained in:
EliteMasterEric
2024-01-12 06:13:34 -05:00
parent 90dd067aa0
commit 025fd326bd
12 changed files with 358 additions and 38 deletions
@@ -13,17 +13,25 @@ class ExtendNoteLengthCommand implements ChartEditorCommand
var note:SongNoteData;
var oldLength:Float;
var newLength:Float;
var unit:Unit;
public function new(note:SongNoteData, newLength:Float)
public function new(note:SongNoteData, newLength:Float, unit:Unit = MILLISECONDS)
{
this.note = note;
this.oldLength = note.length;
this.newLength = newLength;
this.unit = unit;
}
public function execute(state:ChartEditorState):Void
{
note.length = newLength;
switch (unit)
{
case MILLISECONDS:
this.note.length = newLength;
case STEPS:
this.note.setStepLength(newLength);
}
state.saveDataDirty = true;
state.noteDisplayDirty = true;
@@ -36,7 +44,8 @@ class ExtendNoteLengthCommand implements ChartEditorCommand
{
state.playSound(Paths.sound('chartingSounds/undo'));
note.length = oldLength;
// Always use milliseconds for undoing
this.note.length = oldLength;
state.saveDataDirty = true;
state.noteDisplayDirty = true;
@@ -47,6 +56,23 @@ class ExtendNoteLengthCommand implements ChartEditorCommand
public function toString():String
{
return 'Extend Note Length';
if (oldLength == 0)
{
return 'Add Hold to Note';
}
else if (newLength == 0)
{
return 'Remove Hold from Note';
}
else
{
return 'Extend Hold Note Length';
}
}
}
enum Unit
{
MILLISECONDS;
STEPS;
}