1
0
Fork 0
mirror of https://github.com/ninjamuffin99/Funkin.git synced 2024-09-11 20:57:20 +00:00

Improved UI for note snapping (and notif on difficulty change)

This commit is contained in:
EliteMasterEric 2023-09-08 16:44:10 -04:00
parent bb09cc19e7
commit 7a161e4cec
2 changed files with 17 additions and 32 deletions

View file

@ -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
}
/**

View file

@ -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