fixed severaly sync and align bugs with current image indicator...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-12-10 20:38:31 +03:00
parent 7cb2497595
commit e8bdc66c18

View File

@ -279,7 +279,9 @@ module.CurrentImageIndicator = core.ImageGridFeatures.Feature({
doc: '', doc: '',
tag: 'ui-current-image-indicator', tag: 'ui-current-image-indicator',
depends: ['ui'], depends: [
'ui',
],
actions: CurrentImageIndicatorActions, actions: CurrentImageIndicatorActions,
@ -304,14 +306,18 @@ module.CurrentImageIndicator = core.ImageGridFeatures.Feature({
// only on next/prev screen)... // only on next/prev screen)...
// ...still not sure why .preventTransitions(m) did not // ...still not sure why .preventTransitions(m) did not
// do the job. // 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', ['resizeRibbon.pre',
function(target, s){ function(target, s){
var m = this.ribbons.viewer.find('.current-marker') 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... // 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() m.hide()
return function(){ return function(){
@ -330,7 +336,6 @@ module.CurrentImageIndicator = core.ImageGridFeatures.Feature({
// - before animation when scaling up // - before animation when scaling up
// - after when scaling down // - after when scaling down
// This is done to make the visuals consistent... // This is done to make the visuals consistent...
//['fitImage.pre fitRibbon.pre setScale.pre',
['resizing.pre', ['resizing.pre',
function(unit, w1){ function(unit, w1){
var w0 = this[unit] var w0 = this[unit]
@ -396,8 +401,14 @@ module.CurrentImageIndicator = core.ImageGridFeatures.Feature({
// single image view... // single image view...
['toggleSingleImage', ['toggleSingleImage',
function(){ function(){
this.toggleSingleImage('?') == 'off' if(this.toggleSingleImage('?') == 'off'){
&& this.updateCurrentImageIndicator() var m = this.ribbons.viewer.find('.current-marker')
this.ribbons.preventTransitions(m)
this.updateCurrentImageIndicator()
this.ribbons.restoreTransitions(m)
}
}], }],
], ],
}) })