mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 19:00:09 +00:00
made images load without a blackout (pre-caching), still a bit slugish...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
0e7c96e703
commit
bb23f1563a
40
ui/data.js
40
ui/data.js
@ -642,10 +642,19 @@ function convertDataGen1(data, cmp){
|
|||||||
function updateImage(image, gid, size){
|
function updateImage(image, gid, size){
|
||||||
image = $(image)
|
image = $(image)
|
||||||
var title = ''
|
var title = ''
|
||||||
if(gid == null){
|
var oldgid = getImageGID(image)
|
||||||
|
|
||||||
|
if(oldgid == gid || gid == null){
|
||||||
gid = getImageGID(image)
|
gid = getImageGID(image)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
image.attr('gid', JSON.stringify(gid))
|
image
|
||||||
|
.attr('gid', JSON.stringify(gid))
|
||||||
|
.css({
|
||||||
|
// clear the old preview...
|
||||||
|
// XXX set a now loading animation here...
|
||||||
|
'background-image': 'none',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
size = size == null ? getVisibleImageSize('max') : size
|
size = size == null ? getVisibleImageSize('max') : size
|
||||||
|
|
||||||
@ -658,10 +667,21 @@ function updateImage(image, gid, size){
|
|||||||
|
|
||||||
// preview...
|
// preview...
|
||||||
var preview = getBestPreview(gid, size)
|
var preview = getBestPreview(gid, size)
|
||||||
image
|
|
||||||
.css({
|
// pre-cache...
|
||||||
|
// NOTE: make images load without a blackout..
|
||||||
|
var img = new Image()
|
||||||
|
img.src = preview.url
|
||||||
|
img.onload = function(){
|
||||||
|
image.css({
|
||||||
'background-image': 'url("'+ preview.url +'")',
|
'background-image': 'url("'+ preview.url +'")',
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
image
|
||||||
|
//.css({
|
||||||
|
// 'background-image': 'url("'+ preview.url +'")',
|
||||||
|
//})
|
||||||
.attr({
|
.attr({
|
||||||
order: DATA.order.indexOf(gid),
|
order: DATA.order.indexOf(gid),
|
||||||
orientation: img_data.orientation == null ? 0 : img_data.orientation,
|
orientation: img_data.orientation == null ? 0 : img_data.orientation,
|
||||||
@ -679,7 +699,7 @@ function updateImage(image, gid, size){
|
|||||||
|
|
||||||
|
|
||||||
var UPDATE_SORT_ENABLED = false
|
var UPDATE_SORT_ENABLED = false
|
||||||
var UPDATE_SYNC = true
|
var UPDATE_SYNC = false
|
||||||
|
|
||||||
// Same as updateImage(...) but will update all images.
|
// Same as updateImage(...) but will update all images.
|
||||||
//
|
//
|
||||||
@ -725,6 +745,16 @@ function updateImages(size, cmp){
|
|||||||
return deferred
|
return deferred
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
function updateImages(size){
|
||||||
|
size = size == null ? getVisibleImageSize('max') : size
|
||||||
|
return $('.image')
|
||||||
|
.each(function(){
|
||||||
|
updateImage($(this), null, size)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
// Load count images around a given image/gid into the given ribbon.
|
// Load count images around a given image/gid into the given ribbon.
|
||||||
//
|
//
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user