mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
some cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
e2bcd93dd9
commit
629a0dc388
21
ui/data.js
21
ui/data.js
@ -741,28 +741,23 @@ function updateImage(image, gid, size){
|
|||||||
//var name = img_data.path.split('/').pop()
|
//var name = img_data.path.split('/').pop()
|
||||||
|
|
||||||
// preview...
|
// preview...
|
||||||
//var preview = getBestPreview(gid, size)
|
// NOTE: pre-caching the url directly instead of referencing it from
|
||||||
// NOTE: this appears to fix a problem of wrong references in the closure...
|
// 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
|
var p_url = getBestPreview(gid, size).url
|
||||||
|
|
||||||
// XXX added to investigate a problem of sometimes this loading the
|
|
||||||
// wrong image...
|
|
||||||
//image.data().loading = preview.url
|
|
||||||
|
|
||||||
// pre-cache and load image...
|
// pre-cache and load image...
|
||||||
// NOTE: make images load without a blackout..
|
// NOTE: this will make images load without a blackout...
|
||||||
var img = new Image()
|
var img = new Image()
|
||||||
img.onload = function(){
|
img.onload = function(){
|
||||||
// XXX for some reason this is not always the same as image.data().loading!!!
|
|
||||||
// XXX for some reason adding this line makes the problem allot less common!
|
|
||||||
//image.data().loaded = preview.url
|
|
||||||
|
|
||||||
image.css({
|
image.css({
|
||||||
//'background-image': 'url("'+ preview.url +'")',
|
|
||||||
'background-image': 'url("'+ p_url +'")',
|
'background-image': 'url("'+ p_url +'")',
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
//img.src = preview.url
|
// NOTE: this better be after the .onload declaration as in some cases
|
||||||
|
// we can get a cached image load "too fast"...
|
||||||
img.src = p_url
|
img.src = p_url
|
||||||
|
|
||||||
// main attrs...
|
// main attrs...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user