Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concord keyboard handling #13

Open
scripting opened this issue Feb 18, 2020 · 2 comments
Open

Concord keyboard handling #13

scripting opened this issue Feb 18, 2020 · 2 comments

Comments

@scripting
Copy link
Owner

scripting commented Feb 18, 2020

I've been trying to fit a more powerful keystroke capturer under Concord's keyboard handling code, but I'm ready to debug the resulting code. The problem is that none of the JavaScript key handlers will decode an existing event, they have to actually capture the event and call back to the app. Maybe there's an exception, if such a toolkit exists, that would make the systematization of Concord's keystroke handling simple enough to attempt.

Two examples I've considered -- keypress and hotkeys.

To be clear, what I need is this.

$(document).on ("keydown", function (event) {
   var cmdString = keyboardManager.process (event);
   switch (cmdString) {
     case "uparrow":
        moveCursorUp ();
        break;
     //more cases follow
      })

I get that this is hard to do given the browsers ridiculous model for keystroke handling. This kind of stuff should be baked into the browser. The event should have a string that virtualizes the keyboard. Only a videogame or serious graphics app needs the kind of power in the interface for the keyboard, but we all have to handle all the keys as separate events.

@scripting
Copy link
Owner Author

@interstar
Copy link

The P5 library has something like this : https://p5js.org/reference/#/p5/keyPressed

I don't know if that's useful

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants