more tweaking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-04-20 03:46:35 +03:00
parent 12267b7be8
commit 53c1614c82
4 changed files with 34 additions and 99 deletions

View File

@ -429,7 +429,7 @@ var KeyboardActions = actions.Actions({
// limit key repeat to one per N milliseconds.
//
// Set this to -1 or null to run keys without any limitations.
'max-key-repeat-rate': 0,
'keyboard-max-key-repeat-rate': 0,
// The amount of keyboard "quiet" time to wait for when
// .pauseKeyboardRepeat(..) is called...
@ -726,8 +726,8 @@ var KeyboardActions = actions.Actions({
// setup base keyboard for devel, in case something breaks...
// This branch does not drop keys...
if(this.config['max-key-repeat-rate'] < 0
|| this.config['max-key-repeat-rate'] == null){
if(this.config['keyboard-max-key-repeat-rate'] < 0
|| this.config['keyboard-max-key-repeat-rate'] == null){
this.__keyboard_handler = handler
// drop keys if repeating too fast...
@ -738,7 +738,7 @@ var KeyboardActions = actions.Actions({
keyboard.dropRepeatingkeys(
handler,
function(){
return that.config['max-key-repeat-rate'] })
return that.config['keyboard-max-key-repeat-rate'] })
}
target.keydown(handler)

View File

@ -313,7 +313,7 @@ module.CurrentImageIndicator = core.ImageGridFeatures.Feature({
// ...still not sure why .preventTransitions(m) did not
// do the job.
['resizeRibbon.pre',
function(target, s){
function(target){
var m = this.ribbons.viewer.find('.current-marker')
var c = this.current
var r = this.current_ribbon

View File

@ -29,6 +29,13 @@ var PartialRibbonsActions = actions.Actions({
// Sets size of ribbons in single image mode...
'ribbons-resize-single-image': 21,
// can be:
// 'hybrid'
// 'resize'
'ribbons-in-place-update-mode': 'resize',
'ribbons-in-place-update-timeout': 200,
},
updateRibbon: ['- Interface/Update partial ribbon size',
@ -85,107 +92,40 @@ var PartialRibbonsActions = actions.Actions({
|| loaded > size * threshold){
//console.log('RESIZE')
this.resizeRibbon(target, size)
//*/
/*/ XXX long jump condition......
if(img.length != 0
&& (r.length == 0
// ribbon shorter than we expect...
|| (loaded < size && na + pa > loaded)
// ribbon too long...
|| loaded > size * threshold)){
console.log('RESIZE')
this.resizeRibbon(target, size)
// image is off screen -- align off then animate...
// 1) initial state
// T <- [---|---x---|---------------]
// 2) load new state but align off screen
// [-------T-------|-------|---]
// 3) animate
// [---|---T---|---------------]
// XXX this makes the draw worse...
} else if(img.length == 0 ){
console.log('LONG-JUMP')
r.length == 0 ?
// ribbon not loaded...
this.resizeRibbon(target, size)
// simply update...
: this.ribbons
.preventTransitions(r)
.updateRibbonInPlace(
gids,
r_gid,
data.getImageOrder(this.current) > data.getImageOrder(target) ?
gids[gids.length - w]
: gids[w])
.restoreTransitions(r, true)
//*/
// in-place update...
// more complex cases...
// passed threshold on the right...
} else if((nl < update_threshold && na > nl)
// passed threshold on the left...
|| (pl < update_threshold && pa > pl)
// loaded more than we need by threshold...
|| nl + pl + 1 > size + update_threshold){
//console.log('UPDATE')
// resize...
if(r.length == 0
|| (this.toggleSingleImage
&& this.toggleSingleImage('?') == 'on')){
var t = Date.now()
// resize mode...
if(this.config['ribbons-in-place-update-mode'] == 'resize'
// no ribbon loaded...
|| r.length == 0
// only if we are going slow...
|| t - (this.__last_update || 0)
> (this.config['ribbons-in-place-update-timeout'] || 200)
// full screen...
|| (this.toggleSingleImage
&& this.toggleSingleImage('?') == 'on')){
//console.log('RESIZE')
this.resizeRibbon(target, size)
// simply update...
// in-place update...
} else {
// preload...
//console.log('UPDATE')
var c = gids.indexOf(data.getImage('current', r_gid))
var t = gids.indexOf(target)
if(preload
// we are going to shift ribbon in view...
&& c >= 0
// the distance is greater than screen width...
&& Math.abs(t - pl) > w){
console.log('PRELOAD')
// preload head...
if(c > t){
preload = gids.slice(0, pl+w)
gids = preload.slice().fill(false)
.concat(gids.slice(pl+w))
// preload tail...
} else {
preload = gids.slice(0, t+w).fill(false)
.concat(gids.slice(t+w))
gids = gids.slice(0, t+w)
}
// XXX this seems to block the animation....
this.ribbons
.updateRibbonInPlace(preload, r_gid)
}
// main update...
this.ribbons
ribbons
.preventTransitions(r)
.updateRibbonInPlace(
//.updateRibbon(
gids,
r_gid,
// XXX this makes the animation of the ribbon
// a bit smoother but messes up the indicator
// a bit...
// ...this needs the update process to happen
// very fast comparing to the animation itself
// to stay in sync...
//gids.indexOf(this.current) >= 0 ? 'current' : target)
// XXX STUB: this makes the ribbon animation a bit
// jumpy but does not touch the indicator
// animation...
target)
.updateRibbonInPlace(gids, r_gid, target)
.restoreTransitions(r, true)
}
this.__last_update = t
}
}],
})

View File

@ -1642,6 +1642,7 @@ var RibbonsPrototype = {
var that = this
var r = this.getRibbon(ribbon)
var loaded = r.find(IMAGE)
gids = gids.slice(0, loaded.length)
// update offset...
if(reference != null){
@ -1665,10 +1666,8 @@ var RibbonsPrototype = {
}
// update gids...
//var update = []
var unload_marks = []
gids
.slice(0, loaded.length)
.forEach(function(gid, i){
if(gid !== undefined){
var img = loaded.eq(i)
@ -1679,18 +1678,14 @@ var RibbonsPrototype = {
unload_marks.concat(that.getImageMarks(g).toArray())
: unload_marks
gid
&& that.setElemGID(img, gid)
//&& update.push(img[0])
// XXX for some reason this is smoother than:
// gid && that.updateImage(img, gid)
gid && that.updateImage(that.setElemGID(img, gid))
}
})
$(unload_marks)
.remove()
// update images...
this.updateImage(loaded)
//this.updateImage($(update))
return this
},