added mock feature sets, not yet sure how to sturcture these...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2014-11-11 03:07:14 +03:00
parent afa649597d
commit 34dd8e6a01
2 changed files with 61 additions and 0 deletions

View File

@ -180,6 +180,7 @@ $(function(){
window.a = testing.setupActions() window.a = testing.setupActions()
// setup features... // setup features...
/*
// XXX I do not fully understand it yet, but PartialRibbons must be // XXX I do not fully understand it yet, but PartialRibbons must be
// setup BEFORE AlignRibbonsTo*, otherwise the later will break // setup BEFORE AlignRibbonsTo*, otherwise the later will break
// on shifting an image to a new ribbon... // on shifting an image to a new ribbon...
@ -194,6 +195,23 @@ $(function(){
viewer.ShiftAnimation.setup(a) viewer.ShiftAnimation.setup(a)
viewer.BoundsIndicators.setup(a) viewer.BoundsIndicators.setup(a)
viewer.CurrentImageIndicator.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... // this publishes all the actions...
//module.GLOBAL_KEYBOARD.__proto__ = a //module.GLOBAL_KEYBOARD.__proto__ = a

View File

@ -916,10 +916,53 @@ var Feature =
module.Feature = module.Feature =
function Feature(obj){ function Feature(obj){
obj.__proto__ = FeatureProto obj.__proto__ = FeatureProto
// XXX not sure about this...
Features[obj.tag] = obj
return 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 // NOTE: this is split out to an action so as to enable ui elements to