fixed load animations + added mixin methods (needs testing and more thought)...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2014-10-28 03:37:37 +03:00
parent ac03e40193
commit a4449b88d0
2 changed files with 34 additions and 8 deletions

View File

@ -357,8 +357,7 @@ module.MetaActions = {
// //
// NOTE: 'post' mode is the default. // NOTE: 'post' mode is the default.
// //
// XXX add something like text tags to events (extra arg) to enable // XXX document tags...
// simple and fast handler removal...
on: function(actions, b, c){ on: function(actions, b, c){
var handler = typeof(c) == 'function' ? c : b var handler = typeof(c) == 'function' ? c : b
var tag = typeof(c) == 'function' ? b : c var tag = typeof(c) == 'function' ? b : c
@ -407,7 +406,7 @@ module.MetaActions = {
// Remove an action callback... // Remove an action callback...
// //
// XXX needs more testing... // XXX document tags...
off: function(actions, handler){ off: function(actions, handler){
if(this.hasOwnProperty('_action_handlers')){ if(this.hasOwnProperty('_action_handlers')){
@ -461,11 +460,29 @@ module.MetaActions = {
// NOTE: if 'all' is set them mixin all the actions available, // NOTE: if 'all' is set them mixin all the actions available,
// otherwise only mixin local actions... // otherwise only mixin local actions...
mixin: function(from, all){ // XXX test
// XXX link actions from 'from' into this... mixin: function(from, all, all_attr_types){
if(all){
var keys = []
for(var k in from){
keys.push(k)
}
} else {
var keys = Object.keys(from)
}
var that = this
keys.forEach(function(k){
var attr = from[k]
if(all_attr_types || attr instanceof Action){
that[k] = attr
}
})
return this
}, },
mixinto: function(to, all){ mixinto: function(to, all, all_attr_types){
return this.mixin.call(to, this, all) return this.mixin.call(to, this, all, all_attr_types)
}, },
} }

View File

@ -463,7 +463,14 @@ actions.Actions(Client, {
: viewer : viewer
// XXX do we need to recycle the images??? // XXX do we need to recycle the images???
this.ribbons = ribbons.Ribbons(viewer, data.images) // XXX is keeping ribbons here correct???
if(this.ribbons == null){
this.ribbons = ribbons.Ribbons(viewer, data.images)
}
// NOTE: this is here to prevent animations when the view
// is resized and recentered...
this.ribbons.preventTransitions()
return function(){ return function(){
// XXX do a partial load... // XXX do a partial load...
@ -471,6 +478,8 @@ actions.Actions(Client, {
this.ribbons.updateData(this.data) this.ribbons.updateData(this.data)
this.focusImage() this.focusImage()
this.ribbons.restoreTransitions()
} }
}], }],
reload: [ reload: [