From 964483c1bb865a7e7b11018417636768c0b14893 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 29 Mar 2016 00:58:20 +0300 Subject: [PATCH] fixed a bug in .toggleSingeImage(..)... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/core.js | 2 +- ui (gen4)/features/ui-slideshow.js | 2 ++ ui (gen4)/features/ui-status.js | 1 - ui (gen4)/features/ui.js | 51 +++++++++++++++++++----------- 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/ui (gen4)/features/core.js b/ui (gen4)/features/core.js index f39822f9..afa12b78 100755 --- a/ui (gen4)/features/core.js +++ b/ui (gen4)/features/core.js @@ -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'] diff --git a/ui (gen4)/features/ui-slideshow.js b/ui (gen4)/features/ui-slideshow.js index bbd17a6b..fd140949 100755 --- a/ui (gen4)/features/ui-slideshow.js +++ b/ui (gen4)/features/ui-slideshow.js @@ -130,6 +130,8 @@ var SlideshowActions = actions.Actions({ // stop... } else { + this.saveWorkspace('slideshow') + // stop timer... this.__slideshouw_timer && clearTimeout(this.__slideshouw_timer) diff --git a/ui (gen4)/features/ui-status.js b/ui (gen4)/features/ui-status.js index 7025dc9b..3d4a622c 100755 --- a/ui (gen4)/features/ui-status.js +++ b/ui (gen4)/features/ui-status.js @@ -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) })], diff --git a/ui (gen4)/features/ui.js b/ui (gen4)/features/ui.js index 6ef07e5a..883edd96 100755 --- a/ui (gen4)/features/ui.js +++ b/ui (gen4)/features/ui.js @@ -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 + } + } } }], ],