made the pre-caching a bit more flexible...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2015-11-19 18:36:05 +03:00
parent 50a046afe7
commit c9ec561c00

View File

@ -1466,6 +1466,16 @@ module.Journal = ImageGridFeatures.Feature({
// XXX updateRibbon(..) is not signature compatible with data.updateRibbon(..) // XXX updateRibbon(..) is not signature compatible with data.updateRibbon(..)
var PartialRibbonsActions = actions.Actions({ var PartialRibbonsActions = actions.Actions({
// XXX should this be here??? // XXX should this be here???
// XXX should this be run in a worker???
// NOTE: workers when loaded from file:// in a browser context
// will not have access to local images...
// XXX should this be split into two (signatures, functions)?
// - generic -- accepts list of gids
// - context-specific -- current signature
// XXX add special tags:
// - 'ribbon'/<ribbon-gic>
// - 'order'
// XXX make this support an explicit list of gids....
preCacheJumpTargets: ['Interface/Pre-cache potential jump target images', preCacheJumpTargets: ['Interface/Pre-cache potential jump target images',
function(target, tags, radius, size){ function(target, tags, radius, size){
target = target instanceof jQuery target = target instanceof jQuery
@ -1483,11 +1493,27 @@ var PartialRibbonsActions = actions.Actions({
// run async... // run async...
setTimeout(function(){ setTimeout(function(){
tags.forEach(function(tag){ tags.forEach(function(tag){
// order...
if(tag == 'order'){
var source = that.data.order
// current ribbon...
}else if(tag == 'ribbon'){
var source = that.data.ribbons[that.data.getRibbon()]
// ribbon-gid...
} else if(tag in that.data.ribbons){
var source = that.data.ribbons[tag]
// nothing tagged then nothing to do... // nothing tagged then nothing to do...
if(that.data.tags == null } else if(that.data.tags == null
|| that.data.tags[tag] == null || that.data.tags[tag] == null
|| that.data.tags[tag].length == 0){ || that.data.tags[tag].length == 0){
return return
// tag...
} else {
var source = that.data.tags[tag]
} }
size = size || that.ribbons.getVisibleImageSize() size = size || that.ribbons.getVisibleImageSize()
@ -1522,8 +1548,8 @@ var PartialRibbonsActions = actions.Actions({
} }
// get the list of URLs before and after current... // get the list of URLs before and after current...
_get(lst, that.data.tags[tag], radius, 0, 1) _get(lst, source, radius, 0, 1)
_get(lst, that.data.tags[tag], radius, 1, -1) _get(lst, source, radius, 1, -1)
// do the actual preloading... // do the actual preloading...
lst.forEach(function(url){ lst.forEach(function(url){