From 943f4ba4a07fc6e72b57deca9e21117f4b073b49 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 15 Dec 2013 07:41:01 +0400 Subject: [PATCH] fixed a bug in getGIDsAfter(..) + disabled caching as it appears to give no benifits... Signed-off-by: Alex A. Naanou --- ui/data.js | 11 +++++++---- ui/setup.js | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/ui/data.js b/ui/data.js index e85a3d2e..c190e0ff 100755 --- a/ui/data.js +++ b/ui/data.js @@ -1478,6 +1478,9 @@ function getGIDsAfter(count, gid, ribbon, inclusive, data){ } else { var c = inclusive == null ? 0 : 1 var end = ribbon.indexOf(gid) + // avoid -1 value that will wrap around the tail and load the + // whole ribbon... + end = end < 0 ? 0 : end return ribbon.slice((Math.abs(count) >= end ? 0 : end + count + c), end + c) } } @@ -1807,14 +1810,14 @@ function preCacheRibbonImages(ribbon){ var i = getRibbonIndex(ribbon) var size = getVisibleImageSize('max') var screen_size = getScreenWidthInImages(getVisibleImageSize()) - // XXX - var cache_frame_size = (screen_size * LOAD_SCREENS) / 2 + // XXX needs tuning... + var cache_frame_size = (screen_size * LOAD_SCREENS) var images = ribbon.find('.image') var first = getImageGID(images.first()) var last = getImageGID(images.last()) - var gids = getGIDsAfter(-cache_frame_size, first) - .concat(getGIDsAfter(cache_frame_size, last)) + var gids = getGIDsAfter(-cache_frame_size, first, i) + .concat(getGIDsAfter(cache_frame_size, last, i)) var cache = [] IMAGE_CACHE[i] = cache diff --git a/ui/setup.js b/ui/setup.js index bc8dfea4..b29541e5 100755 --- a/ui/setup.js +++ b/ui/setup.js @@ -317,12 +317,14 @@ function setupDataBindings(viewer){ // caching... + /* XXX this appears to actually make things slower... .on('reloadedRibbon updatedRibbon', function(evt, ribbon){ window.DEBUG && console.log('>>> (ribbon:', getRibbonIndex(ribbon), ') Updating cache...') preCacheRibbonImages(ribbon) }) + */ // info... .on('focusingImage',