Skip to content

Commit

Permalink
fix for html5 arrow keys not working on the console (#3247)
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjamuffin99 committed Sep 3, 2024
1 parent 4409577 commit 32d4c35
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions flixel/system/debug/console/Console.hx
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,24 @@ class Console extends Window
if (!history.isEmpty)
setText(history.getPreviousCommand());

#if html5
// FlxKeyboard.preventDefaultKeys adds "preventDefault" on HTML5
// so it ends up not fully propegating our inputs to the stage/event listeners
// we do this small work around so we don't need to mess around with lime/openfl events
// todo: support the modifier keys
case Keyboard.RIGHT:
if (FlxG.keys.preventDefaultKeys.contains(Keyboard.RIGHT))
{
@:privateAccess
input.window_onKeyDown(RIGHT, 0);
}
case Keyboard.LEFT:
if (FlxG.keys.preventDefaultKeys.contains(Keyboard.LEFT))
{
@:privateAccess
input.window_onKeyDown(LEFT, 0);
}
#end
case Keyboard.DOWN:
if (!history.isEmpty)
setText(history.getNextCommand());
Expand Down

0 comments on commit 32d4c35

Please sign in to comment.