merge keyboard shortcut changes

This commit is contained in:
Hakim El Hattab 2012-04-28 11:50:22 -04:00
parent 83e4a1f0ac
commit eee6e5f964
4 changed files with 33 additions and 21 deletions

View File

@ -97,6 +97,7 @@ document.addEventListener( 'someState', function() {
## History ## History
#### 1.3 (master) #### 1.3 (master)
- Revised keyboard shortcuts, including ESC for overview, N for next, P for previous. Thanks [mahemoff](https://github.com/mahemoff)
#### 1.2 #### 1.2
@ -151,4 +152,4 @@ document.addEventListener( 'someState', function() {
MIT licensed MIT licensed
Copyright (C) 2011 Hakim El Hattab, http://hakim.se Copyright (C) 2012 Hakim El Hattab, http://hakim.se

View File

@ -82,7 +82,7 @@
<section> <section>
<h2>Holistic Overview</h2> <h2>Holistic Overview</h2>
<p> <p>
Press <strong>SPACE</strong> to enter the slide overview! Press <strong>ESC</strong> to enter the slide overview!
</p> </p>
</section> </section>

View File

@ -3,7 +3,7 @@
* http://lab.hakim.se/reveal-js * http://lab.hakim.se/reveal-js
* MIT licensed * MIT licensed
* *
* Copyright (C) 2011 Hakim El Hattab, http://hakim.se * Copyright (C) 2012 Hakim El Hattab, http://hakim.se
*/ */
var Reveal = (function(){ var Reveal = (function(){
@ -37,7 +37,8 @@ var Reveal = (function(){
supports3DTransforms = document.body.style['perspectiveProperty'] !== undefined || supports3DTransforms = document.body.style['perspectiveProperty'] !== undefined ||
document.body.style['WebkitPerspective'] !== undefined || document.body.style['WebkitPerspective'] !== undefined ||
document.body.style['MozPerspective'] !== undefined || document.body.style['MozPerspective'] !== undefined ||
document.body.style['msPerspective'] !== undefined, document.body.style['msPerspective'] !== undefined ||
document.body.style['OPerspective'] !== undefined,
supports2DTransforms = document.body.style['transformProperty'] !== undefined || supports2DTransforms = document.body.style['transformProperty'] !== undefined ||
document.body.style['WebkitTransform'] !== undefined || document.body.style['WebkitTransform'] !== undefined ||
@ -155,22 +156,31 @@ var Reveal = (function(){
// FFT: Use document.querySelector( ':focus' ) === null // FFT: Use document.querySelector( ':focus' ) === null
// instead of checking contentEditable? // instead of checking contentEditable?
if ( event.target.contentEditable != 'inherit' || // Disregard the event if the target is editable or a
event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return; // modifier is present
if ( event.target.contentEditable != 'inherit' || event.shiftKey || event.altKey || event.ctrlKey || event.metaKey ) return;
var triggered = false; var triggered = false;
switch( event.keyCode ) { switch( event.keyCode ) {
case 80: case 33: navigatePrev(); triggered = true; break; // prev for wireless presenter (PgUp) // p, page up
case 78: case 32: case 34: navigateNext(); triggered = true; break; // next for wireless presenter (PgDn, Space) case 80: case 33: navigatePrev(); triggered = true; break;
case 72: case 37: navigateLeft(); triggered = true; break; // h, left // n, page down, space
case 76: case 39: navigateRight(); triggered = true; break; // l, right case 78: case 32: case 34: navigateNext(); triggered = true; break;
case 75: case 38: navigateUp(); triggered = true; break; // k, up // h, left
case 74: case 40: navigateDown(); triggered = true; break; // j, down case 72: case 37: navigateLeft(); triggered = true; break;
// l, right
case 76: case 39: navigateRight(); triggered = true; break;
// k, up
case 75: case 38: navigateUp(); triggered = true; break;
// j, down
case 74: case 40: navigateDown(); triggered = true; break;
} }
if (triggered) return event.preventDefault()
if ( event.keyCode === 27 && supports3DTransforms ) {
if( triggered ) {
event.preventDefault();
}
else if ( event.keyCode === 27 && supports3DTransforms ) {
if( overviewIsActive() ) { if( overviewIsActive() ) {
deactivateOverview(); deactivateOverview();
} }

13
js/reveal.min.js vendored

File diff suppressed because one or more lines are too long