Skip to content

Conversation

@cvan
Copy link
Contributor

@cvan cvan commented Mar 21, 2016

No description provided.

@cvan cvan self-assigned this Mar 21, 2016
* Returns whether we can safely listen to this keyboard event.
* @returns {Boolean} True if we can.
*/
module.exports.shouldCaptureKeyEvent = function (event) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed per @dmarcos' suggestion in the previous PR: #1064

@dmarcos
Copy link
Member

dmarcos commented Mar 22, 2016

@cvan What's the state of this. Is this ready to go? Let's use the needs review label otherwise it's hard to tell when PRs are ready.

// Keyboard events
window.addEventListener('keydown', this.onKeyDown, false);
window.addEventListener('keyup', this.onKeyUp, false);
window.addEventListener('blur', this.onBlur);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also have a listener for the symmetric event. window.addEventListener("focus", this.onFocus);?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, very good call.

hmm, the more I think about it we probably shouldn't call pause on blur because that removes the event listeners. and then we'd have to reattach them when play gets called on focus. seems like maybe a waste. thoughts?

@cvan
Copy link
Contributor Author

cvan commented Mar 22, 2016

@dmarcos updated to handle blur/focus/visibilitychange pause/play correctly. good catch, thanks

dmarcos added a commit that referenced this pull request Mar 22, 2016
fix unhandled edge cases for keyboard shortcuts (fixes #927, fixes #932, fixes #1063)
@dmarcos dmarcos merged commit eb81900 into aframevr:master Mar 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

3 participants