From e8bdc66c1817289583f33c22a8eccb8996322768 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 10 Dec 2016 20:38:31 +0300 Subject: [PATCH] fixed severaly sync and align bugs with current image indicator... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/ui-chrome.js | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/ui (gen4)/features/ui-chrome.js b/ui (gen4)/features/ui-chrome.js index 227833e9..59e1c74d 100755 --- a/ui (gen4)/features/ui-chrome.js +++ b/ui (gen4)/features/ui-chrome.js @@ -279,7 +279,9 @@ module.CurrentImageIndicator = core.ImageGridFeatures.Feature({ doc: '', tag: 'ui-current-image-indicator', - depends: ['ui'], + depends: [ + 'ui', + ], actions: CurrentImageIndicatorActions, @@ -304,14 +306,18 @@ module.CurrentImageIndicator = core.ImageGridFeatures.Feature({ // only on next/prev screen)... // ...still not sure why .preventTransitions(m) did not // do the job. - // - // XXX BUG: sometimes this is out of sync with ribbon update resulting - // in the marker positioned in the wrong spot... ['resizeRibbon.pre', function(target, s){ var m = this.ribbons.viewer.find('.current-marker') + var c = this.current + var r = this.currentRibbon + // only update if marker exists and we are in current ribbon... - if(m.length != 0 && this.currentRibbon == this.data.getRibbon(target)){ + if(m.length != 0 + && (target == c + || target == r + || this.data.getRibbon(target) == r + || target == null)){ m.hide() return function(){ @@ -330,7 +336,6 @@ module.CurrentImageIndicator = core.ImageGridFeatures.Feature({ // - before animation when scaling up // - after when scaling down // This is done to make the visuals consistent... - //['fitImage.pre fitRibbon.pre setScale.pre', ['resizing.pre', function(unit, w1){ var w0 = this[unit] @@ -396,8 +401,14 @@ module.CurrentImageIndicator = core.ImageGridFeatures.Feature({ // single image view... ['toggleSingleImage', function(){ - this.toggleSingleImage('?') == 'off' - && this.updateCurrentImageIndicator() + if(this.toggleSingleImage('?') == 'off'){ + var m = this.ribbons.viewer.find('.current-marker') + this.ribbons.preventTransitions(m) + + this.updateCurrentImageIndicator() + + this.ribbons.restoreTransitions(m) + } }], ], })