From a4449b88d0807f179b46db1cc24fc6d525ac18c4 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Tue, 28 Oct 2014 03:37:37 +0300 Subject: [PATCH] fixed load animations + added mixin methods (needs testing and more thought)... Signed-off-by: Alex A. Naanou --- ui (gen4)/lib/actions.js | 31 ++++++++++++++++++++++++------- ui (gen4)/viewer.js | 11 ++++++++++- 2 files changed, 34 insertions(+), 8 deletions(-) diff --git a/ui (gen4)/lib/actions.js b/ui (gen4)/lib/actions.js index b8a19746..d127f36d 100755 --- a/ui (gen4)/lib/actions.js +++ b/ui (gen4)/lib/actions.js @@ -357,8 +357,7 @@ module.MetaActions = { // // NOTE: 'post' mode is the default. // - // XXX add something like text tags to events (extra arg) to enable - // simple and fast handler removal... + // XXX document tags... on: function(actions, b, c){ var handler = typeof(c) == 'function' ? c : b var tag = typeof(c) == 'function' ? b : c @@ -407,7 +406,7 @@ module.MetaActions = { // Remove an action callback... // - // XXX needs more testing... + // XXX document tags... off: function(actions, handler){ if(this.hasOwnProperty('_action_handlers')){ @@ -461,11 +460,29 @@ module.MetaActions = { // NOTE: if 'all' is set them mixin all the actions available, // otherwise only mixin local actions... - mixin: function(from, all){ - // XXX link actions from 'from' into this... + // XXX test + 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){ - return this.mixin.call(to, this, all) + mixinto: function(to, all, all_attr_types){ + return this.mixin.call(to, this, all, all_attr_types) }, } diff --git a/ui (gen4)/viewer.js b/ui (gen4)/viewer.js index 2f8079da..25fb2052 100755 --- a/ui (gen4)/viewer.js +++ b/ui (gen4)/viewer.js @@ -463,7 +463,14 @@ actions.Actions(Client, { : viewer // 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(){ // XXX do a partial load... @@ -471,6 +478,8 @@ actions.Actions(Client, { this.ribbons.updateData(this.data) this.focusImage() + + this.ribbons.restoreTransitions() } }], reload: [