From 4e68345ffeadc6c8efce71715255127b6e27cf2f Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 25 Apr 2016 02:37:57 +0300 Subject: [PATCH] fixed current image indicator alignment on rotated and non sqare image blocks... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/ui-chrome.js | 6 +++--- ui (gen4)/features/ui-single-image.js | 17 ++++++++++++++--- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/ui (gen4)/features/ui-chrome.js b/ui (gen4)/features/ui-chrome.js index 626bbe95..5f51eded 100755 --- a/ui (gen4)/features/ui-chrome.js +++ b/ui (gen4)/features/ui-chrome.js @@ -247,9 +247,9 @@ var CurrentImageIndicatorActions = actions.Actions({ } } - // XXX need to account for image margins.... - //css.left = cur[0].offsetLeft - this.ribbons.dom.setOffset(marker, cur[0].offsetLeft, 0) + this.ribbons.dom.setOffset(marker, + cur[0].offsetLeft - (parseFloat(cur[0].style.marginLeft) || 0), + 0) marker.css(css) }], diff --git a/ui (gen4)/features/ui-single-image.js b/ui (gen4)/features/ui-single-image.js index 12c1b844..87e073bb 100755 --- a/ui (gen4)/features/ui-single-image.js +++ b/ui (gen4)/features/ui-single-image.js @@ -77,9 +77,13 @@ var core = require('features/core') // ribbon view! function updateImageProportions(){ var that = this - var threshold = this.config['single-image-proportions-threshold'] || 2 - var viewer = this.ribbons.viewer + var threshold = this.config['single-image-proportions-threshold'] + if(!threshold || threshold == -1){ + return + } + + var viewer = this.ribbons.viewer var img = this.ribbons.getImage() var w = img.outerWidth() @@ -175,6 +179,7 @@ var SingleImageActions = actions.Actions({ 'single-image-scale': null, 'ribbon-scale': null, + // NOTE: setting this to null or to -1 will disable the feature... 'single-image-proportions-threshold': 2, }, @@ -200,7 +205,6 @@ module.SingleImageView = core.ImageGridFeatures.Feature({ handlers:[ ['fitImage.post setScale.post', function(){ - // singe image mode -- set image proportions... if(this.toggleSingleImage('?') == 'on'){ updateImageProportions.call(this) @@ -211,6 +215,13 @@ module.SingleImageView = core.ImageGridFeatures.Feature({ this.config['ribbon-scale'] = this.screenwidth } }], + // update new images... + ['resizeRibbon', + function(){ + if(this.toggleSingleImage('?') == 'on'){ + updateImageProportions.call(this) + } + }], // 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