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
// 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',
function(name){
this.config['workspaces'] = this.config['workspaces']

View File

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

View File

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

View File

@ -1818,7 +1818,6 @@ var SingleImageActions = actions.Actions({
},
toggleSingleImage: ['Interface/Toggle single image view',
// XXX this is wrong!!!
toggler.CSSClassToggler(
function(){ return this.ribbons.viewer },
'single-image-mode') ],
@ -1920,29 +1919,43 @@ module.SingleImageView = core.ImageGridFeatures.Feature({
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?
['toggleSingleImage.post',
['toggleSingleImage.pre',
function(){
// singe image mode -- set image proportions...
if(this.toggleSingleImage('?') == 'on'){
updateImageProportions.call(this)
var pre_state = this.toggleSingleImage('?')
// update scale...
var w = this.screenwidth
this.config['ribbon-scale'] = w
this.screenwidth = this.config['single-image-scale'] || w
return function(){
var state = this.toggleSingleImage('?')
// ribbon mode -- restore original image size...
} else {
this.ribbons.viewer.find('.image:not(.clone)').css({
width: '',
height: ''
})
// singe image mode -- set image proportions...
if(state == 'on'){
updateImageProportions.call(this)
// update scale...
var w = this.screenwidth
this.config['single-image-scale'] = w
this.screenwidth = this.config['ribbon-scale'] || w
// update scale...
if(state != pre_state){
var w = this.screenwidth
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
}
}
}
}],
],