From bf561c9fa4dc32932132588ee2877157d04c7dba Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Mon, 25 Nov 2013 02:26:38 +0400 Subject: [PATCH] located and fixed (I hope) several pahntom bugs (see todo for details)... Signed-off-by: Alex A. Naanou --- ui/TODO.otl | 26 +++++++++++++++++--------- ui/data.js | 27 ++++++++++++++++++++++----- ui/ribbons.js | 2 ++ 3 files changed, 41 insertions(+), 14 deletions(-) diff --git a/ui/TODO.otl b/ui/TODO.otl index dc976608..010d3509 100755 --- a/ui/TODO.otl +++ b/ui/TODO.otl @@ -108,14 +108,17 @@ Roadmap -[_] 28% Gen 3 current todo - [_] 56% High priority - [_] BUG: @ 9 image width, jumping to end of ribbon length 39 messes up loading... +[_] 30% Gen 3 current todo + [_] 60% High priority + [X] BUG: @ 9 image width, jumping to end of ribbon length 39 messes up loading... | problem likely in loadImagesAround(...) | - | ribbon length 178 also ends up messing things up, while 68 and - | 69 pose no problems... - [_] BUG CLASS (ASAP!): race conditions due to browser rendering lag... + | - ribbon length 178 also ends up messing things up, while 68 and + | 69 pose no problems... + | - 19 images @ 5 per ribbon also breaks things... + | + | was a bug in rollImages(...) + [X] BUG CLASS (ASAP!): race conditions due to browser rendering lag... | this happens when updating/adding lots of elements: | | the update code is done and returns BEFORE the browser is done @@ -123,6 +126,9 @@ Roadmap | | one of the side-effects is that the updates or added elements | do not yet exist when the code is done and returned. + | + | XXX I do not know why or how but this appears to have gotten fixed + | by rewriting loadImages(...) to loadImagesAround(...) [X] BUG: reloadViewer(...) loses image focus... | ...if the image is not near ribbon start. | @@ -156,7 +162,7 @@ Roadmap | | XXX possibly related to | BUG CLASS (ASAP!): race conditions due to browser rendering lag... - [_] BUG: jumping in ribbon sometimes does not load the ribbon correctly... + [X] BUG: jumping in ribbon sometimes does not load the ribbon correctly... | Example 1: | first ribbon in (loaded at first image): | "F:\work\ImageGrid\cur\ImageGrid\src\ui\BUGS\ribbon loading error\" @@ -180,9 +186,11 @@ Roadmap | | XXX possibly related to | BUG CLASS (ASAP!): race conditions due to browser rendering lag... + | + | Appears to be fixed... [_] OSX: add alternatives to function buttons... [_] BUG: OSX: unable to load absolute paths... - [_] BUG: when loading and a non-existing dir, opening a new dir raises an error + [_] BUG: when loading a non-existing dir, opening a new dir raises an error | i.e. the open dialog does not close, while the images are loaded... [_] Q: how do we mark unsorted sections in base ribbon after aligning? | - there is a big gap in the ribbon below, but it's not visible... @@ -316,7 +324,7 @@ Roadmap | centerView() fixes this, but only for the current image... [_] BUG: sometimes images.json folder is created... | can't repeat this yet, and seen only once... - [_] BUG: cropping in single image mode will change image scale... + [X] BUG: cropping in single image mode will change image scale... | likely a problem with reloadViewer(...) [_] 0% full archive index [_] segmented loading of images and data diff --git a/ui/data.js b/ui/data.js index bc5480d5..020f5d58 100755 --- a/ui/data.js +++ b/ui/data.js @@ -1180,6 +1180,15 @@ function updateImage(image, gid, size){ img_data = STUB_IMAGE_DATA } + /* + // set the current class... + if(gid == DATA.current){ + image.addClass('current') + } else { + image.removeClass('current') + } + */ + // preview... var p_url = getBestPreview(gid, size).url // NOTE: due to the fact that loading/caching the image might be at @@ -1421,7 +1430,7 @@ function loadImagesAround(count, gid, ribbon, data){ // no common sections, do a full reload... //if(left == null && right == null){ if(left == null || right == null){ - console.log('Ribbon #'+ribbon+', reloading...') + //console.log('Ribbon #'+ribbon+', reloading...') var n = new_ribbon.indexOf(gid) var o = old_ribbon.indexOf(gid) @@ -1431,11 +1440,13 @@ function loadImagesAround(count, gid, ribbon, data){ var left = n - o var right = (new_ribbon.length - old_ribbon.length) - left + /* console.log(' >>>', left, right, '---', 'old:', old_ribbon.length, '@', o, 'new:', new_ribbon.length, '@', n) + */ extendRibbon(left, right, ribbon_elem) @@ -1450,17 +1461,21 @@ function loadImagesAround(count, gid, ribbon, data){ // XXX buggy... // see: BUG: @ 9 image width, jumping to end of ribbon length 39 messes up loading... } else { + /* console.log('Ribbon #'+ribbon+', updating...') console.log(' >>>', left, right, '---', 'old:', old_ribbon.length, '@', old_ribbon.indexOf(gid), 'new:', new_ribbon.length, '@', new_ribbon.indexOf(gid)) + */ var res = extendRibbon(left, right, ribbon_elem) // XXX this will get all the current images, not the resulting ones... var images = ribbon_elem.find('.image') + //console.log(' >>> images:', images.length, 'res:', res.left.length, res.right.length) + var updated = 0 // update the images... @@ -1617,16 +1632,18 @@ function rollImages(n, ribbon, extend, no_compensate_shift){ if(gids.length == 0){ return $([]) } + var l = gids.length // truncate the results to the length of images... - if(n > images.length){ + if(n > 0 && l > images.length){ gids.reverse().splice(images.length) gids.reverse() - } else if(Math.abs(n) > images.length){ + } else if(l > images.length){ gids.splice(images.length) } + l = gids.length - if(n < images.length){ - images = rollRibbon(gids.length * (n > 0 ? 1 : -1), ribbon, extend, no_compensate_shift) + if(l < images.length){ + images = rollRibbon(l * (n > 0 ? 1 : -1), ribbon, extend, no_compensate_shift) } var size = getVisibleImageSize('max') diff --git a/ui/ribbons.js b/ui/ribbons.js index f753d326..97b677bc 100755 --- a/ui/ribbons.js +++ b/ui/ribbons.js @@ -757,6 +757,7 @@ function prevScreenImages(){ function firstImage(){ $('.viewer').trigger('requestedFirstImage', [getRibbon()]) + // if we are already there, flash the indicator... if(getImage().prevAll('.image').length == 0){ flashIndicator('start') } @@ -768,6 +769,7 @@ function firstImage(){ function lastImage(){ $('.viewer').trigger('requestedLastImage', [getRibbon()]) + // if we are already there, flash the indicator... if(getImage().nextAll('.image').length == 0){ flashIndicator('end') }