mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
added list of ignored keys to cursor autohiding...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
b4d7ee058b
commit
54ffa699e1
@ -391,7 +391,7 @@ module.GLOBAL_KEYBOARD2 = {
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
// XXX DEBUG: remove when done...
|
||||
/*/ XXX DEBUG: remove when done...
|
||||
window.kb = keyboard.Keyboard(
|
||||
GLOBAL_KEYBOARD,
|
||||
function checkGlobalMode(mode, keyboard, context){
|
||||
@ -399,6 +399,7 @@ window.kb = keyboard.Keyboard(
|
||||
return !pattern
|
||||
|| pattern == '*'
|
||||
|| $(keyboard[mode].pattern).length > 0 })
|
||||
//*/
|
||||
|
||||
|
||||
|
||||
@ -574,9 +575,10 @@ var KeyboardActions = actions.Actions({
|
||||
// NOTE: the target element must be focusable...
|
||||
var target =
|
||||
this.__keyboard_event_source =
|
||||
this.config['keyboard-event-source'] ? $(window)
|
||||
(this.config['keyboard-event-source']
|
||||
|| this.config['keyboard-event-source'] == 'window') ?
|
||||
$(window)
|
||||
: this.config['keyboard-event-source'] == 'viewer' ? this.ribbons.viewer
|
||||
: this.config['keyboard-event-source'] == 'window' ? $(window)
|
||||
: this.config['keyboard-event-source'] == 'document' ? $(document)
|
||||
: $(this.config['keyboard-event-source'])
|
||||
|
||||
|
||||
@ -40,6 +40,7 @@
|
||||
var toggler = require('lib/toggler')
|
||||
var actions = require('lib/actions')
|
||||
var features = require('lib/features')
|
||||
var keyboard = require('lib/keyboard2')
|
||||
|
||||
var data = require('imagegrid/data')
|
||||
var images = require('imagegrid/images')
|
||||
@ -1603,6 +1604,10 @@ module.AutoHideCursor = core.ImageGridFeatures.Feature({
|
||||
],
|
||||
|
||||
config: {
|
||||
'cursor-autohide-ignore-keys': [
|
||||
'shift', 'ctrl', 'alt', 'meta',
|
||||
],
|
||||
|
||||
'cursor-autohide': 'on',
|
||||
'cursor-autohide-on-timeout': 'off',
|
||||
'cursor-autohide-on-keyboard': 'on',
|
||||
@ -1675,7 +1680,6 @@ module.AutoHideCursor = core.ImageGridFeatures.Feature({
|
||||
|
||||
// setup...
|
||||
if(state == 'on'){
|
||||
var x, y
|
||||
var timer
|
||||
var timeout =
|
||||
that.toggleAutoHideCursorTimeout('?') == 'on' ?
|
||||
@ -1716,16 +1720,24 @@ module.AutoHideCursor = core.ImageGridFeatures.Feature({
|
||||
var key_handler
|
||||
= this.__cursor_autohide_key_handler
|
||||
= (this.__cursor_autohide_key_handler
|
||||
|| function(){
|
||||
|| function(evt){
|
||||
var viewer = that.ribbons.viewer
|
||||
|
||||
// get key...
|
||||
var key = keyboard.normalizeKey(
|
||||
keyboard.event2key(evt))
|
||||
.join('+')
|
||||
|
||||
// auto-hide is off -- restore...
|
||||
if(!viewer.hasClass('cursor-autohide')){
|
||||
that.toggleHiddenCursor('off')
|
||||
return
|
||||
}
|
||||
|
||||
that.toggleAutoHideCursorKeyboard('?') == 'on'
|
||||
// hide if mode is on and non-ignored key...
|
||||
(that.config['cursor-autohide-ignore-keys']
|
||||
|| []).indexOf(key) < 0
|
||||
&& that.toggleAutoHideCursorKeyboard('?') == 'on'
|
||||
&& that.toggleHiddenCursor('on')
|
||||
|
||||
return true
|
||||
|
||||
@ -260,16 +260,19 @@ function normalizeKey(key){
|
||||
key = splitKey(key)
|
||||
.slice()
|
||||
.sort(function(a, b){
|
||||
a = modifiers.indexOf(a)
|
||||
b = modifiers.indexOf(b)
|
||||
a = modifiers.indexOf(a.toLowerCase())
|
||||
b = modifiers.indexOf(b.toLowerCase())
|
||||
return a >= 0 && b >= 0 ? a - b
|
||||
: a < 0 ? 1
|
||||
: -1 })
|
||||
|
||||
var k = key.pop()
|
||||
k = parseInt(k) ? code2key(parseInt(k)) : k.capitalize()
|
||||
key = key.unique()
|
||||
k = parseInt(k) ? code2key(parseInt(k)) : k
|
||||
k = modifiers.indexOf(k.toLowerCase()) >= 0 ?
|
||||
k.toLowerCase()
|
||||
: k.capitalize()
|
||||
key.push(k)
|
||||
key = key.unique()
|
||||
|
||||
return output == 'array' ?
|
||||
key
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user