teoxoy / factorio-blueprint-editor

A feature-rich Factorio Blueprint Editor
https://fbe.teoxoy.com
MIT License
306 stars 62 forks source link

[BUG] Movement keys for non-query keyboards #239

Open zevisert opened 2 years ago

zevisert commented 2 years ago

Describe the bug Non query keyboard layouts don't use keys in wasd position for movement

To Reproduce Steps to reproduce the behavior:

  1. Go to fbe
  2. Add something so that you can see it move around when you move the viewport
  3. Change your keyboard layout to something like dvorak or colemak
  4. up down left right movement uses the keys for wasd, where ever they are on the keyboard.

Expected behavior I think most people would assume that wars on colemak or ,aoe on dvorak would be used for movement

Desktop (please complete the following information):

Additional context I bet this could be solved by using keydown event.code instead of event.key (docs) for movement.

teoxoy commented 2 years ago

Hmm, I wonder how other apps/games handle this since in the settings panel the key name is shown (instead of key code). I'm not aware of a browser feature to map key codes back to key names (which would depend on the keyboard layout).

What are your thoughts on this?

zevisert commented 2 years ago

I'm not aware of a browser feature to map key codes back to key names (which would depend on the keyboard layout).

I'm not super familiar actually, but I know there is Keyboard.getLayoutMap(), and this reference code values page.

The other thing I saw recently that is kind of a good intro to how hard this is to get right is the latest HTTP 203 episode, if you're into video format.

Overall, there's a LOT to consider when it comes to input - I wouldn't expect every edge case to be handled, I just wanted to bring up the fact that movement is spread all over the keyboard for me.