Skip to content

Commit

Permalink
closes #3, toggles the effects chooser with a keystroke:wq
Browse files Browse the repository at this point in the history
  • Loading branch information
chee committed Jun 9, 2013
1 parent 13ba189 commit 12b8709
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions js/camera.js
Expand Up @@ -5,8 +5,11 @@
navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia;
var URL = window.URL || window.webkitURL;

var SPACE_BAR = 32;
var ESCAPE = 27;
var keycodes = {
space: 32,
esc: 27,
e: 69
}

var video = $( '#video' ).get( 0 );
var canvas = $( '#output' );
Expand All @@ -32,10 +35,12 @@
snap.on( 'click', takePicture );

body.on( 'keyup', function ( event ) {
if ( event.which === SPACE_BAR ) {
if ( event.which === keycodes.space ) {
takePicture();
} else if ( event.which === ESCAPE ) {
} else if ( event.which === keycodes.esc ) {
body.removeClass( 'show-effects' );
} else if ( event.which === keycodes.e ) {
body.toggleClass( 'show-effects' );
}
});

Expand Down Expand Up @@ -132,4 +137,4 @@
function toggleEffects () {
body.toggleClass( 'show-effects' );
}
})( window.chrome, window.jQuery, window._ );
})( window.chrome, window.jQuery, window._ );

0 comments on commit 12b8709

Please sign in to comment.