fixed an odd bug (attempt II)...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-06-14 21:37:59 +04:00
parent c09cb28b99
commit fbeea05cef
2 changed files with 10 additions and 2 deletions

View File

@ -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

View File

@ -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