diff --git a/ui (gen4)/ui.js b/ui (gen4)/ui.js index 98ecfca5..ef832523 100755 --- a/ui (gen4)/ui.js +++ b/ui (gen4)/ui.js @@ -180,6 +180,7 @@ $(function(){ window.a = testing.setupActions() // setup features... + /* // XXX I do not fully understand it yet, but PartialRibbons must be // setup BEFORE AlignRibbonsTo*, otherwise the later will break // on shifting an image to a new ribbon... @@ -194,6 +195,23 @@ $(function(){ viewer.ShiftAnimation.setup(a) viewer.BoundsIndicators.setup(a) viewer.CurrentImageIndicator.setup(a) + */ + + viewer.Features.setup(a, [ + // XXX I do not fully understand it yet, but PartialRibbons must be + // setup BEFORE AlignRibbonsTo*, 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 + 'ui-partial-ribbons', + 'ui-ribbon-align-to-order', + 'ui-single-image-view', + 'ui-animation', + 'ui-bounds-indicators', + 'ui-current-image-indicator', + ]) // this publishes all the actions... //module.GLOBAL_KEYBOARD.__proto__ = a diff --git a/ui (gen4)/viewer.js b/ui (gen4)/viewer.js index d62c6229..62647469 100755 --- a/ui (gen4)/viewer.js +++ b/ui (gen4)/viewer.js @@ -916,10 +916,53 @@ var Feature = module.Feature = function Feature(obj){ obj.__proto__ = FeatureProto + + // XXX not sure about this... + Features[obj.tag] = obj + return obj } +// XXX experimental... +// ...not sure if the global feature set is a good idea... +// XXX might be good to track and automate: +// - priority/precedence +// - exclusivity groups -- i.e. only one from a group can be on. +// - dependency and dependency precedence +// - documentation and control ui +// - title +// - doc +// - ... +var FeatureSet = +module.FeatureSet = { + setup: function(obj, lst){ + lst = lst.constructor !== Array ? [lst] : lst + var that = this + lst.forEach(function(n){ + if(that[n] != null){ + console.log('Setting up feature:', n) + that[n].setup(obj) + } + }) + }, + remove: function(obj, lst){ + lst = lst.constructor !== Array ? [lst] : lst + var that = this + lst.forEach(function(n){ + if(that[n] != null){ + console.log('Removing feature:', n) + that[n].remove(obj) + } + }) + }, +} + + +var Features = +module.Features = Object.create(FeatureSet) + + //--------------------------------------------------------------------- // NOTE: this is split out to an action so as to enable ui elements to