mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
added ribbon focus mode to workspace...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
9d0679cda0
commit
f0f597e5f2
@ -44,20 +44,19 @@ module.makeConfigToggler =
|
||||
function(attr, states, a, b){
|
||||
|
||||
var pre = a
|
||||
var post = b || function(action){ action != null && this.focusImage() }
|
||||
// XXX is this a good default???
|
||||
//var post = b || function(action){ action != null && this.focusImage() }
|
||||
var post = b
|
||||
|
||||
return toggler.Toggler(null,
|
||||
function(_, action){
|
||||
var lst = states.constructor === Array ? states : states.call(this)
|
||||
|
||||
//console.log('action', action)
|
||||
|
||||
if(action == null){
|
||||
return this.config[attr] || lst[lst.indexOf('none')] || lst[0]
|
||||
|
||||
} else {
|
||||
this.config[attr] = action
|
||||
//this.focusImage()
|
||||
}
|
||||
},
|
||||
states, pre, post)
|
||||
|
||||
@ -103,6 +103,11 @@ var SingleImageActions = actions.Actions({
|
||||
//
|
||||
// NOTE: setting this to null or to -1 will disable the feature...
|
||||
'single-image-proportions-threshold': 2,
|
||||
|
||||
// Sets ribbon align mode in single image mode...
|
||||
//
|
||||
// NOTE: if this is null use the workspace value.
|
||||
'single-image-ribbon-focus-mode': 'order',
|
||||
},
|
||||
|
||||
updateImageProportions: ['- Interface/',
|
||||
@ -415,6 +420,25 @@ module.SingleImageView = core.ImageGridFeatures.Feature({
|
||||
}
|
||||
}
|
||||
}],
|
||||
|
||||
// Workspace...
|
||||
// ...set ribbon focus mode to order (default) in single image mode...
|
||||
['saveWorkspace',
|
||||
core.makeWorkspaceConfigWriter(['ribbon-focus-mode'])],
|
||||
['loadWorkspace',
|
||||
core.makeWorkspaceConfigLoader(
|
||||
['ribbon-focus-mode'],
|
||||
function(workspace){
|
||||
if(this.workspace == 'single-image'){
|
||||
var mode = this.config['single-image-ribbon-focus-mode']
|
||||
|| workspace['ribbon-focus-mode']
|
||||
|| 'order'
|
||||
this.toggleRibbonFocusMode(mode)
|
||||
|
||||
} else if('ribbon-focus-mode' in workspace) {
|
||||
this.toggleRibbonFocusMode(workspace['ribbon-focus-mode'])
|
||||
}
|
||||
})],
|
||||
],
|
||||
})
|
||||
|
||||
|
||||
@ -130,6 +130,8 @@
|
||||
// later is enough, but as strict mode is not stable enough (sometimes
|
||||
// works and sometimes does not), we can not reliably pass the element
|
||||
// via 'this'.
|
||||
// XXX add .toString(..) to resulting function to print the source of all
|
||||
// the handlers...
|
||||
var Toggler =
|
||||
module.Toggler =
|
||||
function(elem, state_accessor, states, callback_a, callback_b){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user