added option for keyboard handler to ignore what the actual actions return...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2012-08-19 21:42:14 +04:00
parent 8082695cb4
commit 3e861147e7

View File

@ -932,8 +932,10 @@ function handleImageClick(){
/* // if set to false the event handlers will always return false...
* Basic key format: var KEYBOARD_HANDLER_PROPAGATE = false
/* Basic key format:
* <key-code> : <callback>, * <key-code> : <callback>,
* <key-code> : { * <key-code> : {
* 'default': <callback>, * 'default': <callback>,
@ -991,13 +993,12 @@ function makeKeyboardHandler(keybindings, unhandled){
} }
if(callback != null){ if(callback != null){
var res = callback() var res = callback()
return res?true:false return KEYBOARD_HANDLER_PROPAGATE&&res?true:false
} }
} else { } else {
// simple callback... // simple callback...
var res = handler() var res = handler()
return res?true:false return KEYBOARD_HANDLER_PROPAGATE&&res?true:false
} }
return unhandled(key) return unhandled(key)
} }
@ -1481,7 +1482,7 @@ ImageGrid.GROUP('Ribbon manipulations',
// XXX adding a ribbon above the current is still jumpy, need to devise // XXX adding a ribbon above the current is still jumpy, need to devise
// a cleaner way to do this... // a cleaner way to do this...
ImageGrid.ACTION({ ImageGrid.ACTION({
title: 'Create a ribbon above/below current' title: 'Create a ribbon above/below current',
display: false, display: false,
}, },
function createRibbon(direction){ function createRibbon(direction){
@ -1519,7 +1520,7 @@ ImageGrid.GROUP('Ribbon manipulations',
ImageGrid.ACTION({ ImageGrid.ACTION({
title: 'Merge current and direction ribbon.', title: 'Merge current and direction ribbon.',
doc: 'NOTE: this will take all the elements from direction '+ doc: 'NOTE: this will take all the elements from direction '+
'ribbon and add them to current.' 'ribbon and add them to current.',
display: false, display: false,
}, },
function mergeRibbons(direction, get_order){ function mergeRibbons(direction, get_order){
@ -1634,7 +1635,7 @@ ImageGrid.GROUP('Image manipulation',
// sorting... // sorting...
ImageGrid.ACTION({ ImageGrid.ACTION({
title: 'Sort images via a different criteria', title: 'Sort images via a different criteria',
doc: 'use the cmp function to update image id\'s and resort.' doc: 'use the cmp function to update image id\'s and resort.',
display: false, display: false,
}, },
function sortImagesVia(cmp){ function sortImagesVia(cmp){