minor changes to lib/keyboard.js and keybindings...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-10-04 01:02:35 +04:00
parent 546f379877
commit 74ea7f5344
2 changed files with 31 additions and 16 deletions

View File

@ -40,6 +40,21 @@ function directionImage(reverse){
/*********************************************************************/
var KEYBOARD_CONFIG = {
// Global bindings...
'*': {
title: 'Global bindings',
F4: {
alt: doc('Close viewer',
function(){
closeWindow()
return false
}),
},
F5: doc('Reload viewer', function(){ reload() }),
F12: doc('Show devTools', function(){ showDevTools() }),
},
// info overlay...
//
// NOTE: this is here to prevent selecting images while trying to
@ -69,6 +84,7 @@ var KEYBOARD_CONFIG = {
}
},
// dialogs...
//
'.viewer.overlay .overlay-block.dialog': {
@ -109,7 +125,6 @@ var KEYBOARD_CONFIG = {
},
// help mode...
//
// NOTE: need to keep all info modes before the rest so as to give
@ -301,8 +316,8 @@ var KEYBOARD_CONFIG = {
// general setup...
//
'.viewer:not(.overlay)': {
title: 'Global',
doc: 'These key bindings work in most other modes.'+
title: 'Viewer',
doc: 'These key bindings work in most other viewer modes.'+
'<p>NOTE: shifting all marked images from different ribbons will '+
'perform the operations on ALL marked images but relative '+
@ -632,11 +647,7 @@ var KEYBOARD_CONFIG = {
E: doc('Open image in external software', openImage),
// XXX make F4 a default editor and E a default viewer...
F4: {
default: 'E',
alt: doc('Close viewer', function(){ closeWindow() }),
},
F4: 'E',
// info...
I: {
@ -681,8 +692,8 @@ var KEYBOARD_CONFIG = {
// XXX DEBUG MODE...
// ...remove these in production...
F12: doc('Show devTools', function(){ showDevTools() }),
F5: doc('Reload app', function(){ reload() }),
//F12: doc('Show devTools', function(){ showDevTools() }),
//F5: doc('Reload app', function(){ reload() }),
/* testing the shift-key feature...
'~': {

View File

@ -186,12 +186,16 @@ function getKeyHandlers(key, modifiers, keybindings, modes, shifted_keys){
for(var mode in keybindings){
// test for mode compatibility...
// XXX this fails for explicitly given mode...
if(modes != 'all'
&& (modes != 'any'
&& modes != mode
|| $(mode).length == 0)){
// check if we need to skip this mode...
if( !(modes == 'all'
// explicit mode match...
|| modes == mode
// 'any' means we need to check the mode...
|| (modes == 'any'
// '*' allways matches...
&& mode == '*'
// match the mode...
|| $(mode).length != 0))){
continue
}