From c0725e6218ec440eadd15f0608407077de078670 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 14 Aug 2012 22:28:33 +0400 Subject: [PATCH] cleanup and refactor of key bindings... Signed-off-by: Alex A. Naanou --- ui/keybindings.js | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/ui/keybindings.js b/ui/keybindings.js index 51b04a72..aba0910e 100755 --- a/ui/keybindings.js +++ b/ui/keybindings.js @@ -1,6 +1,7 @@ /*********************************************************************/ // NOTE: use String.fromCharCode(code)... var keybindings = { + // togglable modes and options... //191: toggleHelp, // ? 70: toggleSingleImageMode, // f 83: toggleSingleRibbonMode, // s @@ -11,6 +12,7 @@ var keybindings = { 9: toggleControls, // tab 77: toggleMarkers, // m + // zooming... 187: function(){scaleContainerBy(ZOOM_FACTOR)}, // + 189: function(){scaleContainerBy(1/ZOOM_FACTOR)}, // - @@ -21,10 +23,10 @@ var keybindings = { }, 51: fitThreeImages, // 3 + + // navigation... 36: firstImage, // Home 35: lastImage, // End - - //37: prevImage, // Left 37: { 'default': prevImage, // Right 'ctrl': prevScreenImages, // ctrl-Right @@ -33,7 +35,6 @@ var keybindings = { 80: 37, // BkSp 188: 37, // p 8: 37, // < - //39: nextImage, // Right 39: { 'default': nextImage, // Left 'ctrl': nextScreenImages, // ctrl-Left @@ -42,8 +43,16 @@ var keybindings = { 32: 39, // Space 190: 39, // m 78: 39, // > + // move view... + // XXX should these be s-up, s-down, ... ?? + 75: moveViewUp, // k + 74: moveViewDown, // j + 72: moveViewLeft, // h + 76: moveViewRight, // l + 79: centerCurrentImage, // o - // these work with ctrl and shift modifiers... + + // combined navigation with actions.. 40: { 'default': focusBelowRibbon, // Down 'shift': shiftImageDown, // shift-Down @@ -51,7 +60,7 @@ var keybindings = { createRibbon('next') shiftImageDown() } - }, // Down + }, 38: { 'default': focusAboveRibbon, // Up 'shift': shiftImageUp, // shift-Up @@ -61,29 +70,15 @@ var keybindings = { } }, - // XXX should these be s-up, s-down, ... ?? - 75: moveViewUp, // k - 74: moveViewDown, // j - 72: moveViewLeft, // h - 76: moveViewRight, // l - 79: centerCurrentImage, // o - - - // ignore the modifiers... + // ignore the modifiers (shift, alt, ctrl, caps)... 16: function(){}, 17: 16, 18: 16, 20: 16, // Caps Lock } -/* XXX old bindings... - close: [27, 88, 67], // ??? - // these work with ctrl modifier... - promote: [45], // ??? - demote: [46], // ??? -*/ /*********************************************************************/ // vim:set ts=4 sw=4 nowrap :