mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
refactoring....
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
f0f597e5f2
commit
e468ed35e4
@ -362,6 +362,7 @@ module.makeWorkspaceConfigWriter = function(keys, callback){
|
||||
|
||||
// XXX should this delete a prop if it's not in the loading workspace???
|
||||
// XXX only replace a prop if it has changed???
|
||||
// XXX handle defaults -- when a workspace was just created...
|
||||
var makeWorkspaceConfigLoader =
|
||||
module.makeWorkspaceConfigLoader = function(keys, callback){
|
||||
return function(workspace){
|
||||
@ -390,6 +391,7 @@ module.makeWorkspaceConfigLoader = function(keys, callback){
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
// XXX need a way to handle defaults...
|
||||
var WorkspaceActions = actions.Actions({
|
||||
config: {
|
||||
'load-workspace': 'default',
|
||||
|
||||
@ -104,10 +104,13 @@ 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...
|
||||
// Config defaults to set on first init of single image mode...
|
||||
//
|
||||
// NOTE: if this is null use the workspace value.
|
||||
'single-image-ribbon-focus-mode': 'order',
|
||||
// NOTE: the keys set here will be handled by the 'single-image'
|
||||
// workspace...
|
||||
'single-image-config-defaults': {
|
||||
'ribbon-focus-mode': 'order',
|
||||
},
|
||||
},
|
||||
|
||||
updateImageProportions: ['- Interface/',
|
||||
@ -243,6 +246,14 @@ var SingleImageActions = actions.Actions({
|
||||
|
||||
if(this.workspaces['single-image'] == null){
|
||||
this.loadWorkspace('ui-chrome-hidden')
|
||||
|
||||
// setup defaults...
|
||||
var that = this
|
||||
var defaults = this.config['single-image-config-defaults'] || {}
|
||||
Object.keys(defaults)
|
||||
.forEach(function(key){
|
||||
that.config[key] = JSON.parse(JSON.stringify(defaults[key])) })
|
||||
|
||||
this.saveWorkspace('single-image')
|
||||
}
|
||||
|
||||
@ -424,20 +435,17 @@ module.SingleImageView = core.ImageGridFeatures.Feature({
|
||||
// Workspace...
|
||||
// ...set ribbon focus mode to order (default) in single image mode...
|
||||
['saveWorkspace',
|
||||
core.makeWorkspaceConfigWriter(['ribbon-focus-mode'])],
|
||||
core.makeWorkspaceConfigWriter(
|
||||
Object.keys(SingleImageActions.config['single-image-config-defaults']))],
|
||||
['loadWorkspace',
|
||||
core.makeWorkspaceConfigLoader(
|
||||
['ribbon-focus-mode'],
|
||||
Object.keys(SingleImageActions.config['single-image-config-defaults']),
|
||||
// NOTE: considering that 'ribbon-focus-mode' is handled
|
||||
// by a toggler that can have things bound to it,
|
||||
// active is the way to go here...
|
||||
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'])
|
||||
}
|
||||
'ribbon-focus-mode' in workspace
|
||||
&& this.toggleRibbonFocusMode(workspace['ribbon-focus-mode'])
|
||||
})],
|
||||
],
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user