From 9a9fa74ecb794a7c5083814bd3b3fa74ef0c9659 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 14 Jun 2013 21:47:37 +0400 Subject: [PATCH] updated todo and some cleaning... Signed-off-by: Alex A. Naanou --- ui/TODO.otl | 17 +++++++++++++---- ui/data.js | 11 +++++------ 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/ui/TODO.otl b/ui/TODO.otl index e9f8e964..f2e58891 100755 --- a/ui/TODO.otl +++ b/ui/TODO.otl @@ -91,8 +91,8 @@ Roadmap -[_] 28% Gen 3 current todo - [_] 57% High priority +[_] 29% Gen 3 current todo + [_] 58% High priority [_] BUG: align problems are back... | default data set (browser/images.js) same images #4 (going | from right) & #5 (going from left) of 18 in the first ribbon @@ -104,11 +104,11 @@ Roadmap | misaligned, at "max" #2 and #5 are affected... | | centerView() fixes this, but only for the current image... - [_] 0% BUG: sometimes the previews are not updated... + [_] 50% BUG: sometimes the previews are not updated... [_] wrong resolution preview is loaded | when coming out of single-image-mode after moving to a | different position (so as ribbons go reloaded) - [_] previews do not get replaced at all, e.g. everything + [X] previews do not get replaced at all, e.g. everything | behaves correctly (order, etc.) but the previews are | from wrong (ones before re-attaching) images | (this I can't repeat at this point) @@ -128,6 +128,15 @@ Roadmap | know. | - slowing down the browser appears to make this happen | less often, is this a race condition? + | + | Might be caused by fast sequential updating/reloading of an image: + | - call the updateImage(...) in order several times + | - cache .onload events get called in order of images loading + | not in order of updateImage(...) calls... + | (this cause is not confirmed) + | + | Apparently fixed by storing the preview URL in image.data(), this + | is slower but avoids problems with multiple updates and races... [_] 60% basic dialogs [_] select from list [X] alert diff --git a/ui/data.js b/ui/data.js index a265d0db..187f1ff5 100755 --- a/ui/data.js +++ b/ui/data.js @@ -740,12 +740,12 @@ function updateImage(image, gid, size){ } // preview... - // NOTE: pre-caching the url directly instead of referencing it from - // the result object (preview.url) appears to fix a problem of - // wrong references in the closure of the .onload callback below, - // that sometimes (can't reproduce in a simpler setting) resulted - // in wrong images loading... var p_url = getBestPreview(gid, size).url + // NOTE: due to the fact that loading/caching the image might be at + // a different pace than calling updateImage(...) and .onload + // events may trigger in any sequence, we need to update the + // url in a persistent way so as to load the last call's image + // regardless of actual handler call sequence... image.data().loading = p_url // pre-cache and load image... @@ -753,7 +753,6 @@ function updateImage(image, gid, size){ var img = new Image() img.onload = function(){ image.css({ - //'background-image': 'url("'+ p_url +'")', 'background-image': 'url("'+ image.data().loading +'")', }) }