From fbeea05cefc284d54b1695019d58569eec78770c Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 14 Jun 2013 21:37:59 +0400 Subject: [PATCH] fixed an odd bug (attempt II)... Signed-off-by: Alex A. Naanou --- ui/TODO.otl | 7 +++++++ ui/data.js | 5 +++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ui/TODO.otl b/ui/TODO.otl index 1c755932..e9f8e964 100755 --- a/ui/TODO.otl +++ b/ui/TODO.otl @@ -121,6 +121,13 @@ Roadmap | also, there are times when the ribbon below is partially loaded | or at it's edge when there are other images... | NOTE: calling updateImages() will load the correct previews. + | + | The mechanics of this bug: + | - sometimes the .onload handler gets the right image ref in + | the closue but a wrong p_url, how can this happen I do not + | know. + | - slowing down the browser appears to make this happen + | less often, is this a race condition? [_] 60% basic dialogs [_] select from list [X] alert diff --git a/ui/data.js b/ui/data.js index 8bdc2c61..a265d0db 100755 --- a/ui/data.js +++ b/ui/data.js @@ -738,7 +738,6 @@ function updateImage(image, gid, size){ if(img_data == null){ img_data = STUB_IMAGE_DATA } - //var name = img_data.path.split('/').pop() // preview... // NOTE: pre-caching the url directly instead of referencing it from @@ -747,13 +746,15 @@ function updateImage(image, gid, size){ // that sometimes (can't reproduce in a simpler setting) resulted // in wrong images loading... var p_url = getBestPreview(gid, size).url + image.data().loading = p_url // pre-cache and load image... // NOTE: this will make images load without a blackout... var img = new Image() img.onload = function(){ image.css({ - 'background-image': 'url("'+ p_url +'")', + //'background-image': 'url("'+ p_url +'")', + 'background-image': 'url("'+ image.data().loading +'")', }) } // NOTE: this better be after the .onload declaration as in some cases