fixed shift up/down data handler bug, still do not know why are we missing alignment in connection with preCenteringRibbon handler...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-05-14 02:04:12 +04:00
parent 2ac2db25b0
commit 614f964152

View File

@ -414,6 +414,7 @@ function setupDataBindings(viewer){
// XXX this causes miss-aligns after shifting and/or zooming... // XXX this causes miss-aligns after shifting and/or zooming...
// ...after zooming, moving focus causes the screen to align // ...after zooming, moving focus causes the screen to align
// in an odd way until the next move corrects the issue... // in an odd way until the next move corrects the issue...
// XXX this still is odd when more than one ribbon is present...
.on('preCenteringRibbon', function(evt, ribbon, image){ .on('preCenteringRibbon', function(evt, ribbon, image){
// NOTE: we do not need to worry about centering the ribbon // NOTE: we do not need to worry about centering the ribbon
// here, just ball-park-load the correct batch... // here, just ball-park-load the correct batch...
@ -428,11 +429,12 @@ function setupDataBindings(viewer){
// load images if we do a long jump -- start, end or some mark // load images if we do a long jump -- start, end or some mark
// outside of currently loaded section... // outside of currently loaded section...
if(gid_before == null || gid_before != getImageGID(img_before)){ if(gid_before == null || gid_before != getImageGID(img_before)){
loadImages(gid, Math.round((LOAD_SCREENS * 0.5) * screen_size), ribbon) loadImages(gid, Math.round(screen_size * LOAD_SCREENS), ribbon)
// XXX compensate for the changing number of images... // XXX compensate for the changing number of images...
// roll the ribbon while we are advancing... // roll the ribbon while we are advancing...
} else { }
var head = img_before.prevAll('.image') var head = img_before.prevAll('.image')
var tail = img_before.nextAll('.image') var tail = img_before.nextAll('.image')
@ -452,7 +454,6 @@ function setupDataBindings(viewer){
if(head.length < threshold){ if(head.length < threshold){
var rolled = rollImages(-frame_size, ribbon) var rolled = rollImages(-frame_size, ribbon)
} }
}
}) })
@ -462,13 +463,14 @@ function setupDataBindings(viewer){
to = getRibbonIndex(to) to = getRibbonIndex(to)
var gid = getImageGID(image) var gid = getImageGID(image)
var after = getGIDBefore(gid, to)
// remove the elem from the from ribbon...
var index = DATA.ribbons[from].indexOf(gid) var index = DATA.ribbons[from].indexOf(gid)
var img = DATA.ribbons[from].splice(index, 1) var img = DATA.ribbons[from].splice(index, 1)
// XXX a bit ugly, revise... // put the elem in the to ribbon...
index = ribbon.find('.image') index = after == null ? 0 : DATA.ribbons[to].indexOf(after) + 1
.index(ribbon.find('[gid='+JSON.stringify(gid)+']'))
DATA.ribbons[to].splice(index, 0, gid) DATA.ribbons[to].splice(index, 0, gid)
}) })