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

Presentation thingie does not generate events #57

Open
ggreif opened this issue Jan 9, 2015 · 6 comments
Open

Presentation thingie does not generate events #57

ggreif opened this issue Jan 9, 2015 · 6 comments

Comments

@ggreif
Copy link
Contributor

ggreif commented Jan 9, 2015

I have an USB-dongle that (wirelessly) activates PageUP/Down keys on my keyboard. I have a Mac. However those keystrokes (as well as arrow keys etc. from the keyboard) do not arrive on the server side. I use story-board as the server app, and Chome as the client browser (same with Safari).

Any idea where the change should be made to fix this?

@ggreif ggreif mentioned this issue Jan 9, 2015
@andygill
Copy link
Member

andygill commented Jan 9, 2015

I hacked (something like) this into story-board for a talk I gave last month. The problem was something like keyup / keydown are generated, but not keypress.

If you write a "capture all events" blank-canvas app, we can track down what event the Page Up/Down generates. Something that just registers for every DOM event, and prints to stdout the event. I'll add it as an example on the wiki. The fix will be in story-board, I expect.

@ggreif
Copy link
Contributor Author

ggreif commented Jan 9, 2015

I found this cheat sheet.
Looks like it should be keyup/keydown with keycode 33/34 for PageUp/Down.

@ggreif
Copy link
Contributor Author

ggreif commented Jan 9, 2015

@andygill btw, there is a pull request from me (low prio) for story-board.

@andygill
Copy link
Member

andygill commented Jan 9, 2015

Okay, I'll look at it. It will require a refactor to use keyup/keydown rather than keypress.

@ggreif
Copy link
Contributor Author

ggreif commented Jan 9, 2015

@andygill that would be awesome :-) Thanks!

@ggreif
Copy link
Contributor Author

ggreif commented Jan 21, 2015

Just for the posterity...

I hacked up index.html to modify these two functions:

            function Trigger(e) {
        var o = {};
        o.metaKey = e.metaKey;
                o.type    = e.type;
        if (e.pageXY != undefined) { 
                o.pageXY = e.pageXY; 
            }
        if (e.pageX != undefined && e.pageY != undefined) {
            o.pageXY = [e.pageX,e.pageY];
                }
                if (e.which != undefined) { 
                    o.which = e.which; 
                }

                if (o.type == "keydown" && !o.metaKey) {
                    if (o.which == 33 || o.which == 34 || o.which == 37 || o.which == 39) {
            o.type = "keypress";
            if (o.which == 34 || o.which == 37)
            {
                o.which = 98
            }
                    }
                }
                if (o.type != "keydown") {
                    $.kc.event(o);
                }
            }
            function register(name) {

                $('body').addClass('stop-scrolling');
                $(document).bind(name,Trigger);
                if (name == "keypress") {
                    $(document).bind("keydown",Trigger); }
            }

And now my thingie seems to work. Fingers crossed...

Please do not merge this in your sources, it is an ugly hack!

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