mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
think just managed to make things work correctly with dynamic loading, still need more testing...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
345c9b7286
commit
8bf84c0679
@ -256,22 +256,10 @@ $(function(){
|
||||
var LOADER_THRESHOLD = 2
|
||||
// XXX update this depending on zoom and navigation speed...
|
||||
var LOADER_CHUNK = LOADER_THRESHOLD * 2
|
||||
var IMAGES_IN_RIBBON = 30
|
||||
$('.viewer')
|
||||
/* XXX this is distructive...
|
||||
.on('preCenteringRibbon', function(evt, ribbon, image){
|
||||
// XXX load ONLY if getGIDBefore(getImageGID(image)) is not currently loaded...
|
||||
if( ribbon
|
||||
.find('[gid="'+getGIDBefore(getImageGID(image),
|
||||
getRibbonIndex(ribbon))+'"]')
|
||||
.length > 0 ){
|
||||
console.log('>>> Loading...')
|
||||
loadImages(getImageGID(image), IMAGES_IN_RIBBON, ribbon)
|
||||
}
|
||||
})
|
||||
*/
|
||||
// XXX it takes several steps for adjacent ribbons to catch up...
|
||||
.on('centeringRibbon', function(evt, ribbon, image){
|
||||
// NOTE: we do not need to worry about centering the ribbon
|
||||
// here, just ball-park-load the correct batch...
|
||||
// check if we are in the right range...
|
||||
var gid = getImageGID(image)
|
||||
var r = getRibbonIndex(ribbon)
|
||||
@ -287,11 +275,15 @@ $(function(){
|
||||
var gr = DATA.ribbons[r]
|
||||
//console.log('>>>', gr.indexOf(gid_before) - gr.indexOf(cur))
|
||||
rollImages(gr.indexOf(gid_before) - gr.indexOf(cur), ribbon)
|
||||
|
||||
//centerRibbon(ribbon, image)
|
||||
|
||||
//return
|
||||
}
|
||||
})
|
||||
// XXX it takes several steps for adjacent ribbons to catch up...
|
||||
.on('centeringRibbon', function(evt, ribbon, image){
|
||||
// check if we are in the right range...
|
||||
var gid = getImageGID(image)
|
||||
var r = getRibbonIndex(ribbon)
|
||||
var img_before = getImageBefore(image, ribbon)
|
||||
var gid_before = getGIDBefore(gid, r)
|
||||
|
||||
if(img_before.length == 0){
|
||||
img_before = ribbon.find('.image').first()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user