mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-11-01 20:00:10 +00:00
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:
parent
afa649597d
commit
34dd8e6a01
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user