found an odd bug, worked around it, need to understand it!

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2014-10-30 03:27:11 +03:00
parent 02889c5f7e
commit da49103a53
2 changed files with 30 additions and 19 deletions

View File

@ -169,11 +169,18 @@ $(function(){
window.a = testing.setupActions() window.a = testing.setupActions()
// setup features... // setup features...
// XXX I do not full understand it yet, but PartialRibbons must be
// setup BEFORE RibbonAlignToFirst, otherwise the later will break
// on shifting an image to a new ribbon...
// To reproduce:
// - setupe RibbonAlignToFirst first
// - go to top ribbon
// - shift image up
viewer.PartialRibbons.setup(a)
viewer.RibbonAlignToOrder.setup(a) viewer.RibbonAlignToOrder.setup(a)
//viewer.RibbonAlignToFirst.setup(a) //viewer.RibbonAlignToFirst.setup(a)
viewer.ShiftAnimation.setup(a) viewer.ShiftAnimation.setup(a)
viewer.BoundsIndicators.setup(a) viewer.BoundsIndicators.setup(a)
viewer.PartialRibbons.setup(a)
// this publishes all the actions... // this publishes all the actions...
//module.GLOBAL_KEYBOARD.__proto__ = a //module.GLOBAL_KEYBOARD.__proto__ = a

View File

@ -22,14 +22,10 @@ var reloadAfter =
module.reloadAfter = module.reloadAfter =
function reloadAfter(transitions){ function reloadAfter(transitions){
return function(){ return function(){
// prevent animations form adding/removing ribbons...
!transitions && this.ribbons.preventTransitions()
return function(){ return function(){
// NOTE: this may seem like cheating, but .reload() should // NOTE: this may seem like cheating, but .reload() should
// be very efficient, reusing all of the items loaded... // be very efficient, reusing all of the items loaded...
this.reload() this.reload()
!transitions && this.ribbons.restoreTransitions()
} }
} }
} }
@ -528,7 +524,6 @@ actions.Actions(Client, {
// align modes... // align modes...
// XXX skip invisible ribbons (???) // XXX skip invisible ribbons (???)
// XXX load data chunks...
alignByOrder: ['Align ribbons by image order', alignByOrder: ['Align ribbons by image order',
function(target){ function(target){
var ribbons = this.ribbons var ribbons = this.ribbons
@ -554,8 +549,6 @@ actions.Actions(Client, {
// XXX skip off-screen ribbons... // XXX skip off-screen ribbons...
// XXX see if we need to do some loading...
// center... // center...
// XXX is there a 'last' special case here??? // XXX is there a 'last' special case here???
var t = data.getImage(gid, r) var t = data.getImage(gid, r)
@ -899,13 +892,20 @@ module.FeatureProto = {
var Feature = var Feature =
module.Feature = module.Feature =
function Feature(obj){ function Feature(obj){
obj.__proto__ = this.FeatureProto obj.__proto__ = FeatureProto
return obj return obj
} }
// XXX revise... // XXX I do not fully understand it yet, but PartialRibbons must be
// setup BEFORE RibbonAlignToFirst, otherwise the later will break
// on shifting an image to a new ribbon...
// To reproduce:
// - setupe RibbonAlignToFirst first
// - go to top ribbon
// - shift image up
// The two should be completely independent....
// XXX need to test and tweak with actual images... // XXX need to test and tweak with actual images...
var PartialRibbons = var PartialRibbons =
module.PartialRibbons = Feature({ module.PartialRibbons = Feature({
@ -947,18 +947,22 @@ module.PartialRibbons = Feature({
// loaded more than we need by threshold... // loaded more than we need by threshold...
|| nl + pl + 1 > s + t){ || nl + pl + 1 > s + t){
// localize transition prevention...
// NOTE: we can't get ribbon via target directly here as // NOTE: we can't get ribbon via target directly here as
// the target might not be loaded... // the target might not be loaded...
var r = this.ribbons.getRibbon(this.data.getRibbon(target)) var r_gid = this.data.getRibbon(target)
this.ribbons // localize transition prevention...
.preventTransitions(r) var r = this.ribbons.getRibbon(r_gid)
.updateRibbon(
this.data.getImages(target, s), if(r.length > 0){
this.data.getRibbon(target), this.ribbons
target) .preventTransitions(r)
.restoreTransitions(r, true) .updateRibbon(
this.data.getImages(target, s),
r_gid,
target)
.restoreTransitions(r, true)
}
} }
} }