"Delete Stacked Notes" functionality for the chart editor (#935)

* Delete Stacked Notes

* unstack selection

* Attempts to translate to italian and polish

i do not know these languages so if they're wrong im sorry
This commit is contained in:
Bitto
2026-03-30 04:51:57 +07:00
committed by GitHub
parent d874ea0348
commit e0b5369eb5
6 changed files with 41 additions and 12 deletions
+32 -8
View File
@@ -232,6 +232,11 @@ class Charter extends UIState {
label: translate("edit.delete"),
keybind: [DELETE],
onSelect: _edit_delete
},
{
label: translate("edit.deletestacked"),
keybind: [SHIFT,DELETE],
onSelect: _edit_deletestacked
}
]
},
@@ -459,7 +464,7 @@ class Charter extends UIState {
rightEventsGroup.eventsRowText = rightEventRowText;
// thank you neo for pointing out im stupid -lunar
// this is future lunar i completely forgot what neo pointed out but hes awesome go follow him on twitter
// this is future lunar i completely forgot what neo pointed out but hes awesome go follow him on twitter
add(gridBackdropDummy = new CameraHoverDummy(gridBackdrops, FlxPoint.weak(1, 0)));
selectionBox = new UISliceSprite(0, 0, 2, 2, 'editors/ui/selection');
@@ -978,7 +983,7 @@ class Charter extends UIState {
currentCursor = ARROW;
}
case NONE:
if (FlxG.mouse.justPressed)
if (FlxG.mouse.justPressed)
FlxG.mouse.getWorldPosition(charterCamera, dragStartPos);
else if (FlxG.mouse.justPressedRight) {
closeCurrentContextMenu();
@@ -1719,6 +1724,25 @@ class Charter extends UIState {
selection = deleteSelection(selection, true);
}
function _edit_deletestacked(_) {
UIState.playEditorSound(Flags.DEFAULT_EDITOR_DELETE_SOUND);
if (notesGroup.members.length == 0) return;
var oldNote:CharterNote = null;
var selectionArray:Array<Dynamic> = ((selection.length != 0) ? selection : notesGroup.members.copy());
var toDelete:Selection = new Selection();
for (note in selectionArray) {
if (oldNote != null && oldNote.step == note.step && oldNote.strumLineID == note.strumLineID && oldNote.id == note.id) {
noteDeleteAnims.deleteNotes.push({note: oldNote, time: noteDeleteAnims.deleteTime});
toDelete.push(oldNote);
}
oldNote = note;
}
if (toDelete.length != 0) {
deleteSelection(toDelete);
if (selection.length != 0) for (i in toDelete) selection.remove(i); //crash prevention
}
}
function _undo(undo:CharterChange) {
UIState.playEditorSound(Flags.DEFAULT_EDITOR_UNDO_SOUND);
switch(undo) {
@@ -1955,7 +1979,7 @@ class Charter extends UIState {
if (PlayState.SONG.bookmarks != null)
bookmarks = PlayState.SONG.bookmarks;
} catch (e) {}
return bookmarks;
}
@@ -1965,9 +1989,9 @@ class Charter extends UIState {
var currentBookmarks:Array<ChartBookmark> = getBookmarkList();
var newBookmarks:Array<ChartBookmark> = getBookmarkList();
newBookmarks.push({time: daStep, name: name, color: color.toWebString()});
PlayState.SONG.bookmarks = newBookmarks;
updateBookmarks();
updateBookmarks();
undos.addToUndo(CEditBookmarks(currentBookmarks, newBookmarks));
}
@@ -1992,7 +2016,7 @@ class Charter extends UIState {
{
var bars:Array<FlxSprite> = bs[0];
var text:UIText = bs[1];
if (bars != null) {
for (spr in bars) {
if (spr == null) continue;
@@ -2046,7 +2070,7 @@ class Charter extends UIState {
0,
scrollBar.height
);
var bookmarkspr = new FlxSprite(scrollBar.x - 10, yPos).makeSolid(40, 4, bookmarkcolor);
uiGroup.add(bookmarkspr);
sprites.push(bookmarkspr);
@@ -2330,7 +2354,7 @@ class Charter extends UIState {
icon: this.noteType == 0 ? 1 : 0
}];
final noteKeys:Array<Array<Array<FlxKey>>> = [[[ZERO], [NUMPADZERO]], [[ONE], [NUMPADONE]], [[TWO], [NUMPADTWO]], [[THREE], [NUMPADTHREE]], [[FOUR], [NUMPADFOUR]], [[FIVE], [NUMPADFIVE]],
final noteKeys:Array<Array<Array<FlxKey>>> = [[[ZERO], [NUMPADZERO]], [[ONE], [NUMPADONE]], [[TWO], [NUMPADTWO]], [[THREE], [NUMPADTHREE]], [[FOUR], [NUMPADFOUR]], [[FIVE], [NUMPADFIVE]],
[[SIX], [NUMPADSIX]], [[SEVEN], [NUMPADSEVEN]], [[EIGHT], [NUMPADEIGHT]], [[NINE], [NUMPADNINE]]];
for (i=>type in noteTypes) {
var realNoteID:Int = i+1; // Default Note not stored