Listen to custom mapped togglePause keys

This resolves issue #941
This commit is contained in:
David Banham 2014-06-25 23:22:13 +10:00
parent 131c00689a
commit a078c87f10
2 changed files with 9 additions and 4 deletions

View file

@ -2658,8 +2658,13 @@ var Reveal = (function(){
// keyboard modifier key is present // keyboard modifier key is present
if( hasFocus || (event.shiftKey && event.keyCode !== 32) || event.altKey || event.ctrlKey || event.metaKey ) return; if( hasFocus || (event.shiftKey && event.keyCode !== 32) || event.altKey || event.ctrlKey || event.metaKey ) return;
// While paused only allow "unpausing" keyboard events (b and .) // While paused only allow "unpausing" keyboard events ('b', '.' or any key specifically mapped to togglePause )
if( isPaused() && [66,190,191].indexOf( event.keyCode ) === -1 ) { var allowedKeys = [66,190,191].concat(Object.keys(config.keyboard).map(function(key){
if (config.keyboard[key] === 'togglePause') {
return parseInt(key, 10);
}
}));
if( isPaused() && allowedKeys.indexOf( event.keyCode ) === -1 ) {
return false; return false;
} }

4
js/reveal.min.js vendored

File diff suppressed because one or more lines are too long