From 7a161e4ceca61b5046b0145728a70c36835db453 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 8 Sep 2023 16:44:10 -0400 Subject: [PATCH] Improved UI for note snapping (and notif on difficulty change) --- .../ui/debug/charting/ChartEditorState.hx | 47 +++++++------------ .../debug/charting/ChartEditorThemeHandler.hx | 2 +- 2 files changed, 17 insertions(+), 32 deletions(-) diff --git a/source/funkin/ui/debug/charting/ChartEditorState.hx b/source/funkin/ui/debug/charting/ChartEditorState.hx index f27fbb6c7..870b6953e 100644 --- a/source/funkin/ui/debug/charting/ChartEditorState.hx +++ b/source/funkin/ui/debug/charting/ChartEditorState.hx @@ -183,8 +183,6 @@ class ChartEditorState extends HaxeUIState * INSTANCE DATA */ // ============================== - public var currentZoomLevel:Float = 1.0; - var noteSnapQuantIndex:Int = 3; public var noteSnapQuant(get, never):Int; @@ -1768,8 +1766,7 @@ class ChartEditorState extends HaxeUIState // These ones only happen if the modal dialog is not open. handleScrollKeybinds(); - // handleZoom(); - // handleSnap(); + handleSnap(); handleCursor(); handleMenubar(); @@ -1999,37 +1996,14 @@ class ChartEditorState extends HaxeUIState if (shouldPause) stopAudioPlayback(); } - function handleZoom():Void - { - if (FlxG.keys.justPressed.MINUS) - { - currentZoomLevel /= 2; - - // Update the grid. - ChartEditorThemeHandler.updateTheme(this); - // Update the note positions. - noteDisplayDirty = true; - } - - if (FlxG.keys.justPressed.PLUS) - { - currentZoomLevel *= 2; - - // Update the grid. - ChartEditorThemeHandler.updateTheme(this); - // Update the note positions. - noteDisplayDirty = true; - } - } - function handleSnap():Void { - if (FlxG.keys.justPressed.LEFT) + if (FlxG.keys.justPressed.LEFT && !FlxG.keys.pressed.CONTROL) { noteSnapQuantIndex--; } - if (FlxG.keys.justPressed.RIGHT) + if (FlxG.keys.justPressed.RIGHT && !FlxG.keys.pressed.CONTROL) { noteSnapQuantIndex++; } @@ -2555,8 +2529,7 @@ class ChartEditorState extends HaxeUIState if (gridGhostNote == null) throw "ERROR: Tried to handle cursor, but gridGhostNote is null! Check ChartEditorState.buildGrid()"; - var noteData:SongNoteData = gridGhostNote.noteData != null ? gridGhostNote.noteData : new SongNoteData(cursorMs, cursorColumn, 0, - selectedNoteKind); + var noteData:SongNoteData = gridGhostNote.noteData != null ? gridGhostNote.noteData : new SongNoteData(cursorMs, cursorColumn, 0, selectedNoteKind); if (cursorColumn != noteData.data || selectedNoteKind != noteData.kind) { @@ -2892,6 +2865,8 @@ class ChartEditorState extends HaxeUIState var songRemainingString:String = '-${songRemainingMinutes}:${songRemainingSeconds}'; setUIValue('playbarSongRemaining', songRemainingString); + + setUIValue('playbarNoteSnap', '1/${noteSnapQuant}'); } /** @@ -3090,6 +3065,16 @@ class ChartEditorState extends HaxeUIState refreshSongMetadataToolbox(); } } + + #if !mac + NotificationManager.instance.addNotification( + { + title: 'Switch Difficulty', + body: 'Switched difficulty to ${selectedDifficulty.toTitleCase()}', + type: NotificationType.Success, + expiryMs: ChartEditorState.NOTIFICATION_DISMISS_TIME + }); + #end } /** diff --git a/source/funkin/ui/debug/charting/ChartEditorThemeHandler.hx b/source/funkin/ui/debug/charting/ChartEditorThemeHandler.hx index 9b1e82df1..17906dac2 100644 --- a/source/funkin/ui/debug/charting/ChartEditorThemeHandler.hx +++ b/source/funkin/ui/debug/charting/ChartEditorThemeHandler.hx @@ -125,7 +125,7 @@ class ChartEditorThemeHandler // 2 * (Strumline Size) + 1 grid squares wide, by (4 * quarter notes per measure) grid squares tall. // This gets reused to fill the screen. var gridWidth:Int = Std.int(ChartEditorState.GRID_SIZE * TOTAL_COLUMN_COUNT); - var gridHeight:Int = Std.int(ChartEditorState.GRID_SIZE * Conductor.stepsPerMeasure * state.currentZoomLevel); + var gridHeight:Int = Std.int(ChartEditorState.GRID_SIZE * Conductor.stepsPerMeasure); state.gridBitmap = FlxGridOverlay.createGrid(ChartEditorState.GRID_SIZE, ChartEditorState.GRID_SIZE, gridWidth, gridHeight, true, gridColor1, gridColor2); // Selection borders