@@ -796,6 +796,7 @@ class Charter extends UIState {
796796 public var mousePos : FlxPoint = new FlxPoint ();
797797 public var selectionDragging : Bool = false ;
798798 public var isSelecting : Bool = false ;
799+ public var isAltCopyDrag : Bool = false ;
799800
800801 public function updateSelectionLogic () {
801802 function select (s : ICharterSelectable ) {
@@ -960,10 +961,17 @@ class Charter extends UIState {
960961 if (! (verticalChange == 0 && horizontalChange == 0 )) {
961962 notesGroup .sortNotes ();
962963
963- undos .addToUndo (CChangeBundle ([
964- CSelectionDrag (undoDrags ),
965- updateEventsGroups (selection )
966- ]));
964+ var changes : Array <CharterChange > = [];
965+ if (isAltCopyDrag ) {
966+ changes .push (CCreateSelection (selection .copy ()));
967+ isAltCopyDrag = false ;
968+ }
969+ changes .push (CSelectionDrag (undoDrags ));
970+ changes .push (updateEventsGroups (selection ));
971+ undos .addToUndo (CChangeBundle (changes ));
972+ } else if (isAltCopyDrag ) {
973+ undos .addToUndo (CCreateSelection (selection .copy ()));
974+ isAltCopyDrag = false ;
967975 }
968976
969977 gridActionType = NONE ;
@@ -1018,7 +1026,32 @@ class Charter extends UIState {
10181026 }
10191027
10201028 if ((Math .abs (mousePos .x - dragStartPos .x ) > (noteSusDrag ? 1 : 5 ) || Math .abs (mousePos .y - dragStartPos .y ) > (noteSusDrag ? 1 : 5 ))) {
1021- if (noteHovered ) gridActionType = noteHovered ? NOTE_DRAG : INVALID_DRAG ;
1029+ if (noteHovered ) {
1030+ if (FlxG .keys .pressed .ALT && selection .length > 0 ) {
1031+ var newSelection : Array <ICharterSelectable > = [];
1032+ for (s in selection ) {
1033+ if (s is CharterNote ) {
1034+ var n : CharterNote = cast s ;
1035+ var newNote = new CharterNote ();
1036+ newNote .updatePos (n .step , n .id , n .susLength , n .type , n .strumLine );
1037+ notesGroup .add (newNote );
1038+ newSelection .push (newNote );
1039+ } else if (s is CharterEvent ) {
1040+ var e : CharterEvent = cast s ;
1041+ var newEvent = new CharterEvent (e .step , [for (event in e .events ) Reflect .copy (event )], e .global );
1042+ newEvent .refreshEventIcons ();
1043+ (e .global ? rightEventsGroup : leftEventsGroup ).add (newEvent );
1044+ newSelection .push (newEvent );
1045+ }
1046+ }
1047+ for (s in selection ) s .selected = false ;
1048+ selection = newSelection ;
1049+ for (s in selection ) s .selected = true ;
1050+ isAltCopyDrag = true ;
1051+ UIState .playEditorSound (Flags .DEFAULT_EDITOR_COPY_SOUND );
1052+ }
1053+ gridActionType = NOTE_DRAG ;
1054+ }
10221055 if (noteSusDrag ) gridActionType = SUSTAIN_DRAG ;
10231056 }
10241057 }
@@ -1736,7 +1769,11 @@ class Charter extends UIState {
17361769 case CEditSpecNotesType (notes , oldTypes , newTypes ):
17371770 for (i => note in notes ) note .updatePos (note .step , note .id , note .susLength , oldTypes [i ]);
17381771 case CChangeBundle (changes ):
1739- for (change in changes ) _undo (change );
1772+ var i = changes .length - 1 ;
1773+ while (i >= 0 ) {
1774+ _undo (changes [i ]);
1775+ i -- ;
1776+ }
17401777 }
17411778 }
17421779
0 commit comments