Use key scancode instead of key character #124
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, scale workshop uses the property KeyboardEvents.which (deprecated name of KeyboardEvents.key), this makes key identification dependent of the user's keyboard layout.
However there is now a more appropriate property which is KeyboardEvent.code, which gives the physical position of the key.
Right now I have just added some keymapping code to synth.js as a quick proof of concept, so I can get guidance on how to actually implement the change.
I have some doubts about how MacOS handles the .code property however.
According to this, it may not give the actual physical key position, but I may be misunderstanding the statement.
If a MacOS user can check if my fork works with different keyboard layouts it would be very useful.
If it works on MacOS, I don't see a reason to keep the keyboard layout handling code/dropdown. Otherwise, it may still be needed as a special case.
EDIT:
#123
Bonus, I haven't implemented it yet but it should be easy to accommodate for differences in the ISO and ANSI layouts with this change.
#114
Also, actually, even if this works on MacOS, some layout handling code may still be needed because of odd keyboards that don't follow the standard ISO/ANSI shape. I think the right long term solution for this is to allow the user to remap any scancode to any position on the grid (or not necessarily a grid), but this will be for a later PR. #31