mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
several fixes and tweaks...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
80f579e31c
commit
ca9c39293d
@ -1272,7 +1272,8 @@ var SelfTestActions = actions.Actions({
|
||||
tests.forEach(function(action){
|
||||
that[action]()
|
||||
|
||||
logger.emit('done', action)
|
||||
logger
|
||||
&& logger.emit('done', action)
|
||||
})
|
||||
})],
|
||||
})
|
||||
|
||||
@ -657,10 +657,10 @@ var ExampleUIActions = actions.Actions({
|
||||
}],
|
||||
|
||||
|
||||
// XXX BUG: right limit indicator can get covered by the scrollbar...
|
||||
// XXX migrate to the dialog framework...
|
||||
// XXX use this.dom as base...
|
||||
// XXX BUG: when using this.dom as base some actions leak
|
||||
// between the two viewers...
|
||||
// XXX BUG: this breaks keyboard handling when closed...
|
||||
showTaggedInDrawer: ['- Test/Show tagged in drawer',
|
||||
function(tag){
|
||||
tag = tag || 'bookmark'
|
||||
@ -672,10 +672,12 @@ var ExampleUIActions = actions.Actions({
|
||||
height: H,
|
||||
background: 'black',
|
||||
})
|
||||
.attr('tabindex', '0')
|
||||
// XXX use this.dom as base...
|
||||
// XXX when using viewer zoom and other stuff get leaked...
|
||||
var widget = drawer.Drawer($('body'),
|
||||
$('<div>')
|
||||
.addClass('image-list-widget')
|
||||
.css({
|
||||
position: 'relative',
|
||||
height: H,
|
||||
@ -684,95 +686,75 @@ var ExampleUIActions = actions.Actions({
|
||||
{
|
||||
focusable: true,
|
||||
})
|
||||
.on('close', function(){
|
||||
that.nested.stop()
|
||||
|
||||
//delete that.nested
|
||||
})
|
||||
|
||||
|
||||
var data = this.data.crop(this.data.getTaggedByAll(tag), true)
|
||||
|
||||
var b = new core.ImageGrid()
|
||||
|
||||
// used switch experimental actions on (set to true) or off (unset or false)...
|
||||
//a.experimental = true
|
||||
|
||||
// setup actions...
|
||||
core.ImageGridFeatures.setup(b, [
|
||||
'viewer-testing',
|
||||
])
|
||||
|
||||
// setup the viewer...
|
||||
// XXX for some reason if we load this with data and images
|
||||
// the images will not show up...
|
||||
b.load({
|
||||
viewer: viewer,
|
||||
})
|
||||
this.nested = core.ImageGridFeatures
|
||||
// setup actions...
|
||||
// XXX prune the features a bit better...
|
||||
.setup([
|
||||
'viewer-testing',
|
||||
|
||||
// load some testing data...
|
||||
// NOTE: we can (and do) load this in parts...
|
||||
b
|
||||
.load({
|
||||
data: data,
|
||||
images: this.images,
|
||||
})
|
||||
// this is needed when loading legacy sources that do not have tags
|
||||
// synced...
|
||||
// do not do for actual data...
|
||||
//.syncTags()
|
||||
.fitImage(1)
|
||||
// NOTE: this if not disabled will create a feedback loop...
|
||||
'-ui-url-hash',
|
||||
|
||||
// link navigation...
|
||||
.on('focusImage', function(){
|
||||
that.focusImage(this.current)
|
||||
})
|
||||
'-ui-single-image',
|
||||
'-ui-chrome',
|
||||
])
|
||||
.run(function(){
|
||||
this.close = function(){ widget.close() }
|
||||
|
||||
// XXX setup keyboard...
|
||||
var keyboard = require('lib/keyboard')
|
||||
this.config['keyboard-event-source'] = viewer
|
||||
|
||||
/*/ XXX update this to use .keyboard
|
||||
// XXX move this to the .config...
|
||||
var kb = {
|
||||
// XXX hack -- need a better way to set this (a setter?)...
|
||||
this.__keyboard_config = {
|
||||
'Basic Control': {
|
||||
pattern: '*',
|
||||
|
||||
Home: {
|
||||
default: 'firstImage!',
|
||||
},
|
||||
End: {
|
||||
default: 'lastImage!',
|
||||
},
|
||||
Left: {
|
||||
default: 'prevImage!',
|
||||
ctrl: 'prevScreen!',
|
||||
// XXX need to prevent default on mac + browser...
|
||||
meta: 'prevScreen!',
|
||||
},
|
||||
Home: 'firstImage!',
|
||||
End: 'lastImage!',
|
||||
Left: 'prevImage!',
|
||||
ctrl_Left: 'prevScreen!',
|
||||
meta_Left: 'prevScreen!',
|
||||
PgUp: 'prevScreen!',
|
||||
PgDown: 'nextScreen!',
|
||||
Right: {
|
||||
default: 'nextImage!',
|
||||
ctrl: 'nextScreen!',
|
||||
// XXX need to prevent default on mac + browser...
|
||||
meta: 'nextScreen!',
|
||||
Right: 'nextImage!',
|
||||
ctrl_Right: 'nextScreen!',
|
||||
meta_Right: 'nextScreen!',
|
||||
|
||||
Esc: 'close!',
|
||||
},
|
||||
}
|
||||
}
|
||||
})
|
||||
// load some testing data...
|
||||
.load({
|
||||
viewer: viewer,
|
||||
data: data,
|
||||
images: this.images,
|
||||
})
|
||||
.fitImage(1)
|
||||
// XXX for some reason this is not called...
|
||||
.refresh()
|
||||
// link navigation...
|
||||
.on('focusImage', function(){
|
||||
that.focusImage(this.current) })
|
||||
// start things up...
|
||||
.start()
|
||||
.focusImage()
|
||||
|
||||
widget.dom
|
||||
// XXX
|
||||
.keydown(
|
||||
keyboard.dropRepeatingkeys(
|
||||
keyboard.makeKeyboardHandler(
|
||||
kb,
|
||||
function(k){
|
||||
window.DEBUG && console.log(k)
|
||||
},
|
||||
b),
|
||||
function(){
|
||||
return that.config['max-key-repeat-rate']
|
||||
}))
|
||||
//*/
|
||||
// XXX need to focus widget -- use a real trigger event instead of timer...
|
||||
setTimeout(function(){
|
||||
that.nested.dom.focus()
|
||||
}, 200)
|
||||
|
||||
// XXX STUB
|
||||
window.b = b
|
||||
|
||||
return b
|
||||
return this.nested
|
||||
}],
|
||||
showBookmarkedInDrawer: ['Test/Show bookmarked in drawer',
|
||||
function(){ this.showTaggedInDrawer('bookmark') }],
|
||||
|
||||
@ -516,12 +516,16 @@ var KeyboardActions = actions.Actions({
|
||||
}
|
||||
|
||||
var a = keyboard.parseActionCall(code, that)
|
||||
var doc = a.doc || that.getDocTitle(a.action) || null
|
||||
var doc = a.doc
|
||||
|| (that.getDocTitle && that.getDocTitle(a.action))
|
||||
|| null
|
||||
|
||||
// check if we have no doc...
|
||||
if(doc == null || doc == ''){
|
||||
console.warn('Action has no doc: "'
|
||||
+ a.action +'" at: "'+ code +'"')
|
||||
// XXX ???
|
||||
return
|
||||
}
|
||||
|
||||
// see if two actions have the same doc...
|
||||
@ -846,6 +850,10 @@ module.Keyboard = core.ImageGridFeatures.Feature({
|
||||
this.toggleKeyboardHandling('on')
|
||||
}],
|
||||
|
||||
['stop',
|
||||
function(){
|
||||
this.toggleKeyboardHandling('off') }],
|
||||
|
||||
// pause keyboard repeat...
|
||||
['shiftImageUp.pre shiftImageDown.pre',
|
||||
function(){
|
||||
|
||||
@ -354,7 +354,7 @@ module.CurrentImageIndicator = core.ImageGridFeatures.Feature({
|
||||
// XXX is it a good idea to used the same timers for all instances???
|
||||
var makeIndicatorHiderOnFastAction = function(hide_timeout){
|
||||
return function(){
|
||||
if(this.toggleSingleImage('?') == 'on'){
|
||||
if(this.toggleSingleImage && this.toggleSingleImage('?') == 'on'){
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -671,6 +671,7 @@ module.StatusBar = core.ImageGridFeatures.Feature({
|
||||
tag: 'ui-status-bar',
|
||||
depends: [
|
||||
'ui',
|
||||
'ui-chrome',
|
||||
|
||||
// XXX this is here to enable context menu
|
||||
// see: StatusBarActions.__statusbar_elements__.mark(..)
|
||||
|
||||
@ -485,6 +485,8 @@ var makeDrawer = function(direction){
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Higher level dialog action constructors...
|
||||
|
||||
@ -569,6 +571,21 @@ function makeConfigListEditorDialog(path, options){
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
var Chrome =
|
||||
module.Chrome = core.ImageGridFeatures.Feature({
|
||||
title: '',
|
||||
doc: '',
|
||||
|
||||
tag: 'ui-chrome',
|
||||
depends: [
|
||||
'ui',
|
||||
],
|
||||
})
|
||||
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
var DialogsActions = actions.Actions({
|
||||
@ -852,6 +869,7 @@ module.Dialogs = core.ImageGridFeatures.Feature({
|
||||
tag: 'ui-dialogs',
|
||||
depends: [
|
||||
'ui',
|
||||
'ui-chrome',
|
||||
],
|
||||
|
||||
actions: DialogsActions,
|
||||
@ -2052,6 +2070,7 @@ module.Buttons = core.ImageGridFeatures.Feature({
|
||||
tag: 'ui-buttons',
|
||||
depends: [
|
||||
'ui',
|
||||
'ui-chrome'
|
||||
],
|
||||
suggested: [
|
||||
// needed for reporting info in .makeButtonControls(..)
|
||||
|
||||
@ -993,7 +993,7 @@ module.URLHash = core.ImageGridFeatures.Feature({
|
||||
['stop',
|
||||
function(){
|
||||
this.__hashchange_handler
|
||||
&& $(window).on('hashchange', this.__hashchange_handler)
|
||||
&& $(window).off('hashchange', this.__hashchange_handler)
|
||||
}],
|
||||
// store/restore hash when we focus images...
|
||||
['focusImage',
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user