mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-12-20 10:11:40 +00:00
fixed skipping of ribbons outside of viewer area...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
7de9c70604
commit
9406d6c5b8
44
ui/setup.js
44
ui/setup.js
@ -85,7 +85,6 @@ function setupDataBindings(viewer){
|
|||||||
|
|
||||||
// NOTE: we do not need to worry about explicit centering the ribbon
|
// NOTE: we do not need to worry about explicit centering the ribbon
|
||||||
// here, just ball-park-load the correct batch...
|
// here, just ball-park-load the correct batch...
|
||||||
// XXX this does not get called on marking...
|
|
||||||
.on('preCenteringRibbon', function(evt, ribbon, image){
|
.on('preCenteringRibbon', function(evt, ribbon, image){
|
||||||
var r = getRibbonIndex(ribbon)
|
var r = getRibbonIndex(ribbon)
|
||||||
|
|
||||||
@ -94,41 +93,45 @@ function setupDataBindings(viewer){
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// skip the whole thing if the ribbon is not visible -- outside
|
// skip the whole thing if the ribbon is not visible, i.e. outside
|
||||||
// of viewer are...
|
// of viewer area...
|
||||||
var viewer = $('.viewer')
|
// NOTE: we are accounting for position relative to image...
|
||||||
var H = viewer.height()
|
// NOTE: we do not need to account for image height because
|
||||||
var h = getImage().height()
|
// of origin and vertical-align... (check)
|
||||||
var t = getRelativeVisualPosition(viewer, ribbon).top
|
|
||||||
// XXX also check for visibility...
|
// XXX also check for visibility...
|
||||||
if( t+h <= 0 || t >= H ){
|
var R = $('.viewer').height()/2
|
||||||
|
var d = Math.abs(getRelativeVisualPosition(image, ribbon).top)
|
||||||
|
if( d >= R ){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare for loading...
|
// prepare for loading...
|
||||||
var gid = getImageGID(image)
|
var gid = getImageGID(image)
|
||||||
var gr = DATA.ribbons[r]
|
var gr = DATA.ribbons[r]
|
||||||
var img_before = getImageBefore(image, ribbon)
|
|
||||||
var gid_before = getGIDBefore(gid, r)
|
var gid_before = getGIDBefore(gid, r)
|
||||||
|
var img_before = gid_before == null
|
||||||
|
? ribbon.find('.image').first()
|
||||||
|
: getImageBefore(image, ribbon)
|
||||||
|
gid_before = gid_before == null ? gr[0] : gid_before
|
||||||
|
|
||||||
var screen_size = getScreenWidthInImages()
|
var screen_size = getScreenWidthInImages()
|
||||||
screen_size = screen_size < 1 ? 1 : screen_size
|
screen_size = screen_size < 1 ? 1 : screen_size
|
||||||
var load_frame_size = Math.round(screen_size * LOAD_SCREENS)
|
var load_frame_size = Math.round(screen_size * LOAD_SCREENS)
|
||||||
|
|
||||||
// either current image is loaded or we are at head...
|
// either current image is loaded or we are at head...
|
||||||
if(gid_before != null
|
if(gid_before == getImageGID(img_before)){
|
||||||
&& gid_before == getImageGID(img_before)){
|
|
||||||
var head = img_before.prevAll('.image').length
|
|
||||||
var tail = img_before.nextAll('.image').length
|
|
||||||
var l = ribbon.find('.image').length
|
|
||||||
var index = gr.indexOf(gid)
|
|
||||||
var at_start = index < threshold
|
|
||||||
var at_end = (gr.length-1 - index) < threshold
|
|
||||||
|
|
||||||
var roll_frame_size = Math.ceil(load_frame_size / 3)
|
var roll_frame_size = Math.ceil(load_frame_size / 3)
|
||||||
var threshold = Math.floor(load_frame_size / 4)
|
var threshold = Math.floor(load_frame_size / 4)
|
||||||
threshold = threshold < 1 ? 1 : threshold
|
threshold = threshold < 1 ? 1 : threshold
|
||||||
|
|
||||||
|
var head = img_before.prevAll('.image').length
|
||||||
|
var tail = img_before.nextAll('.image').length
|
||||||
|
var l = ribbon.find('.image').length
|
||||||
|
var index = gr.indexOf(gid_before)
|
||||||
|
var at_start = index < threshold
|
||||||
|
var at_end = (gr.length-1 - index) < threshold
|
||||||
|
|
||||||
// less images than expected - extend ribbon...
|
// less images than expected - extend ribbon...
|
||||||
if(l < load_frame_size){
|
if(l < load_frame_size){
|
||||||
// NOTE: we are forcing the count of images...
|
// NOTE: we are forcing the count of images...
|
||||||
@ -184,11 +187,13 @@ function setupDataBindings(viewer){
|
|||||||
.on('requestedFirstImage', function(evt, ribbon){
|
.on('requestedFirstImage', function(evt, ribbon){
|
||||||
var r = getRibbonIndex(ribbon)
|
var r = getRibbonIndex(ribbon)
|
||||||
var gr = DATA.ribbons[r]
|
var gr = DATA.ribbons[r]
|
||||||
|
console.log('!!!!! rolling to first:', r)
|
||||||
rollImages(-gr.length, ribbon)
|
rollImages(-gr.length, ribbon)
|
||||||
})
|
})
|
||||||
.on('requestedLastImage', function(evt, ribbon){
|
.on('requestedLastImage', function(evt, ribbon){
|
||||||
var r = getRibbonIndex(ribbon)
|
var r = getRibbonIndex(ribbon)
|
||||||
var gr = DATA.ribbons[r]
|
var gr = DATA.ribbons[r]
|
||||||
|
console.log('!!!!! rolling to last:', r)
|
||||||
rollImages(gr.length, ribbon)
|
rollImages(gr.length, ribbon)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -230,9 +235,6 @@ function setupDataBindings(viewer){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update proportions...
|
// update proportions...
|
||||||
// XXX for some magical reason this is stable for un-rotated
|
|
||||||
// images and does mad things for rotate 90/270 images...
|
|
||||||
// ...the only thing that is
|
|
||||||
if(window.PROPORTIONS_RATIO_THRESHOLD != null
|
if(window.PROPORTIONS_RATIO_THRESHOLD != null
|
||||||
&& toggleSingleImageMode('?') == 'on'){
|
&& toggleSingleImageMode('?') == 'on'){
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user