more tweaking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-04-20 04:00:28 +03:00
parent 53c1614c82
commit 127fad78b5

View File

@ -60,6 +60,11 @@ var PartialRibbonsActions = actions.Actions({
var data = this.data var data = this.data
var ribbons = this.ribbons var ribbons = this.ribbons
var t = Date.now()
this.__last_update = this.__last_update || t
var timeout = this.config['ribbons-in-place-update-timeout']
// localize transition prevention... // localize transition prevention...
// NOTE: we can't get ribbon via target directly here as // NOTE: we can't get ribbon via target directly here as
// the target might not be loaded... // the target might not be loaded...
@ -90,7 +95,7 @@ var PartialRibbonsActions = actions.Actions({
|| (loaded < size && na + pa > loaded) || (loaded < size && na + pa > loaded)
// ribbon too long... // ribbon too long...
|| loaded > size * threshold){ || loaded > size * threshold){
//console.log('RESIZE') console.log('RESIZE')
this.resizeRibbon(target, size) this.resizeRibbon(target, size)
// more complex cases... // more complex cases...
@ -100,23 +105,22 @@ var PartialRibbonsActions = actions.Actions({
|| (pl < update_threshold && pa > pl) || (pl < update_threshold && pa > pl)
// loaded more than we need by threshold... // loaded more than we need by threshold...
|| nl + pl + 1 > size + update_threshold){ || nl + pl + 1 > size + update_threshold){
var t = Date.now()
// resize mode... // resize mode...
if(this.config['ribbons-in-place-update-mode'] == 'resize' if(this.config['ribbons-in-place-update-mode'] == 'resize'
// no ribbon loaded... // no ribbon loaded...
|| r.length == 0 || r.length == 0
// only if we are going slow... // only if we are going slow...
|| t - (this.__last_update || 0) || (timeout != null
> (this.config['ribbons-in-place-update-timeout'] || 200) && (t - this.__last_update > timeout))
// full screen... // full screen...
|| (this.toggleSingleImage || (this.toggleSingleImage
&& this.toggleSingleImage('?') == 'on')){ && this.toggleSingleImage('?') == 'on')){
//console.log('RESIZE') //console.log('RESIZE', t-this.__last_update)
this.resizeRibbon(target, size) this.resizeRibbon(target, size)
// in-place update... // in-place update...
} else { } else {
//console.log('UPDATE') //console.log('UPDATE', t - this.__last_update)
var c = gids.indexOf(data.getImage('current', r_gid)) var c = gids.indexOf(data.getImage('current', r_gid))
var t = gids.indexOf(target) var t = gids.indexOf(target)
@ -125,8 +129,9 @@ var PartialRibbonsActions = actions.Actions({
.updateRibbonInPlace(gids, r_gid, target) .updateRibbonInPlace(gids, r_gid, target)
.restoreTransitions(r, true) .restoreTransitions(r, true)
} }
this.__last_update = t
} }
this.__last_update = t
}], }],
}) })