mac keyboard shortcuts on stage editor

This commit is contained in:
Cameron Taylor 2024-09-30 19:03:11 -04:00
parent 8cd7f2a5b1
commit 623985a2cc
2 changed files with 5 additions and 4 deletions

View file

@ -292,7 +292,7 @@ class StageEditorState extends UIState
{ {
WindowManager.instance.reset(); WindowManager.instance.reset();
instance = this; instance = this;
FlxG.sound.music.stop(); FlxG.sound.music?.stop();
WindowUtil.setWindowTitle("Friday Night Funkin\' Stage Editor"); WindowUtil.setWindowTitle("Friday Night Funkin\' Stage Editor");
AssetDataHandler.init(this); AssetDataHandler.init(this);
@ -503,7 +503,7 @@ class StageEditorState extends UIState
return super.beatHit(); return super.beatHit();
} }
override public function update(elapsed:Float) override public function update(elapsed:Float):Void
{ {
updateBGSize(); updateBGSize();
conductorInUse.update(); conductorInUse.update();
@ -563,7 +563,8 @@ class StageEditorState extends UIState
// key shortcuts and inputs // key shortcuts and inputs
if (allowInput) if (allowInput)
{ {
if (FlxG.keys.pressed.CONTROL) // "WINDOWS" key code is the same keycode as COMMAND on mac
if (FlxG.keys.pressed.CONTROL || FlxG.keys.pressed.WINDOWS)
{ {
if (FlxG.keys.justPressed.Z) onMenuItemClick("undo"); if (FlxG.keys.justPressed.Z) onMenuItemClick("undo");
if (FlxG.keys.justPressed.Y) onMenuItemClick("redo"); if (FlxG.keys.justPressed.Y) onMenuItemClick("redo");

View file

@ -6,7 +6,7 @@ import funkin.ui.debug.stageeditor.StageEditorState.StageEditorDialogType;
class UndoRedoHandler class UndoRedoHandler
{ {
public static function performLastAction(state:StageEditorState, redo:Bool = false) public static function performLastAction(state:StageEditorState, redo:Bool = false):Void
{ {
if (state == null || (state.undoArray.length <= 0 && !redo) || (state.redoArray.length <= 0 && redo)) return; if (state == null || (state.undoArray.length <= 0 && !redo) || (state.redoArray.length <= 0 && redo)) return;
var actionToDo = redo ? state.redoArray.pop() : state.undoArray.pop(); var actionToDo = redo ? state.redoArray.pop() : state.undoArray.pop();