diff --git a/ui (gen4)/features/ui-single-image.js b/ui (gen4)/features/ui-single-image.js index 8b51b880..d65d76fb 100755 --- a/ui (gen4)/features/ui-single-image.js +++ b/ui (gen4)/features/ui-single-image.js @@ -131,48 +131,38 @@ function updateImageProportions(){ // horizontal viewer... if(Di == H){ - images - .each(function(_, img){ - var o = img.getAttribute('orientation') - o = o == null ? 0 : o - - // rotated images... - if(o == 90 || o == 270){ - img.style.width = '' - img.style.height = n + 'px' - - img.style.margin = -(n - di)/2 +'px '+ (n - di)/2 +'px' - - } else { - img.style.width = n + 'px' - img.style.height = '' - - img.style.margin = '' - } - }) + var a = 'width' + var b = 'height' // vertical viewer... } else { - images - .each(function(_, img){ - var o = img.getAttribute('orientation') - o = o == null ? 0 : o - - // rotated images... - if(o == 90 || o == 270){ - img.style.width = n + 'px' - img.style.height = '' - - img.style.margin = -(n - di)/2 +'px '+ (n - di)/2 +'px' - - } else { - img.style.width = '' - img.style.height = n + 'px' - - img.style.margin = '' - } - }) + var a = 'height' + var b = 'width' } + + images + .each(function(_, img){ + var o = img.getAttribute('orientation') + o = o == null ? 0 : o + + // rotated images... + if(o == 90 || o == 270){ + img.style[a] = '' + img.style[b] = n + 'px' + + img.style.margin = -(n - di)/2 +'px '+ (n - di)/2 +'px' + + } else { + img.style[a] = n + 'px' + img.style[b] = '' + + img.style.margin = '' + } + }) + + // XXX for some reason this is not working correctly... + //that.alignRibbons() + //that.ribbons.restoreTransitions(true) that.ribbons .centerImage() @@ -310,6 +300,8 @@ module.SingleImageView = core.ImageGridFeatures.Feature({ this.ribbons.centerImage() + // XXX need to correctly align other ribbons... + // update scale... if(state != pre_state){ var s = this.scale diff --git a/ui (gen4)/features/ui.js b/ui (gen4)/features/ui.js index 59649c19..93752036 100755 --- a/ui (gen4)/features/ui.js +++ b/ui (gen4)/features/ui.js @@ -1564,14 +1564,8 @@ module.AutoAlignRibbons = core.ImageGridFeatures.Feature({ }, actions: actions.Actions({ - toggleRibbonAlignMode : ['Interface/Toggle ribbon align mode', - core.makeConfigToggler('ribbon-align-mode', - function(){ return this.config['ribbon-align-modes'] })], - }), - - handlers: [ - ['focusImage.post', - function(){ + alignRibbons: ['Interface/Align ribbons', + function(){ var mode = this.config['ribbon-align-mode'] || this.config['ribbon-focus-mode'] @@ -1589,6 +1583,14 @@ module.AutoAlignRibbons = core.ImageGridFeatures.Feature({ .centerImage() } }], + toggleRibbonAlignMode : ['Interface/Toggle ribbon align mode', + core.makeConfigToggler('ribbon-align-mode', + function(){ return this.config['ribbon-align-modes'] })], + }), + + handlers: [ + ['focusImage.post', + function(){ this.alignRibbons() }], ], })