fixed a bug in .toggleSingeImage(..)...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-03-29 00:58:20 +03:00
parent 01797476e4
commit 964483c1bb
4 changed files with 35 additions and 21 deletions

View File

@ -289,7 +289,7 @@ var WorkspaceActions = actions.Actions({
// save nothing. this us useful for introspection and temporary // save nothing. this us useful for introspection and temporary
// context storage. // context storage.
// //
// XXX for some reason this does not trigger a .config save... // XXX for some reason this does not get saved with .config...
saveWorkspace: ['Workspace/Save Workspace', saveWorkspace: ['Workspace/Save Workspace',
function(name){ function(name){
this.config['workspaces'] = this.config['workspaces'] this.config['workspaces'] = this.config['workspaces']

View File

@ -130,6 +130,8 @@ var SlideshowActions = actions.Actions({
// stop... // stop...
} else { } else {
this.saveWorkspace('slideshow')
// stop timer... // stop timer...
this.__slideshouw_timer this.__slideshouw_timer
&& clearTimeout(this.__slideshouw_timer) && clearTimeout(this.__slideshouw_timer)

View File

@ -453,7 +453,6 @@ module.StatusBar = core.ImageGridFeatures.Feature({
}], }],
// Workspace... // Workspace...
// XXX is storing all the config a bit too much???
['saveWorkspace', ['saveWorkspace',
core.makeWorkspaceConfigWriter( core.makeWorkspaceConfigWriter(
function(){ return Object.keys(StatusBar.config) })], function(){ return Object.keys(StatusBar.config) })],

View File

@ -1818,7 +1818,6 @@ var SingleImageActions = actions.Actions({
}, },
toggleSingleImage: ['Interface/Toggle single image view', toggleSingleImage: ['Interface/Toggle single image view',
// XXX this is wrong!!!
toggler.CSSClassToggler( toggler.CSSClassToggler(
function(){ return this.ribbons.viewer }, function(){ return this.ribbons.viewer },
'single-image-mode') ], 'single-image-mode') ],
@ -1920,29 +1919,43 @@ module.SingleImageView = core.ImageGridFeatures.Feature({
this.config['ribbon-scale'] = this.screenwidth this.config['ribbon-scale'] = this.screenwidth
} }
}], }],
// NOTE: this is not part of the actual action above because we
// need to see if the state has changed and doing this with
// two separate pre/post callbacks (toggler callbacks) is
// harder than with two nested callbacks (action callbacks)
// XXX this uses .screenwidth for scale, is this the right way to go? // XXX this uses .screenwidth for scale, is this the right way to go?
['toggleSingleImage.post', ['toggleSingleImage.pre',
function(){ function(){
// singe image mode -- set image proportions... var pre_state = this.toggleSingleImage('?')
if(this.toggleSingleImage('?') == 'on'){
updateImageProportions.call(this)
// update scale... return function(){
var w = this.screenwidth var state = this.toggleSingleImage('?')
this.config['ribbon-scale'] = w
this.screenwidth = this.config['single-image-scale'] || w
// ribbon mode -- restore original image size... // singe image mode -- set image proportions...
} else { if(state == 'on'){
this.ribbons.viewer.find('.image:not(.clone)').css({ updateImageProportions.call(this)
width: '',
height: ''
})
// update scale... // update scale...
var w = this.screenwidth if(state != pre_state){
this.config['single-image-scale'] = w var w = this.screenwidth
this.screenwidth = this.config['ribbon-scale'] || w this.config['ribbon-scale'] = w
this.screenwidth = this.config['single-image-scale'] || w
}
// ribbon mode -- restore original image size...
} else {
this.ribbons.viewer.find('.image:not(.clone)').css({
width: '',
height: ''
})
// update scale...
if(state != pre_state){
var w = this.screenwidth
this.config['single-image-scale'] = w
this.screenwidth = this.config['ribbon-scale'] || w
}
}
} }
}], }],
], ],