in the midle of teamwork reorg why does promise not defer?

This commit is contained in:
Peter Cottle 2013-06-02 17:16:14 -07:00
parent 292126437a
commit bf6f987482
4 changed files with 129 additions and 58 deletions

View file

@ -2,6 +2,7 @@ var _ = require('underscore');
var Backbone = require('backbone');
var Animation = require('./index').Animation;
var PromiseAnimation = require('./index').PromiseAnimation;
var GRAPHICS = require('../../util/constants').GRAPHICS;
/******************
@ -19,19 +20,12 @@ var AnimationFactory = function() {
};
AnimationFactory.prototype.genCommitBirthAnimation = function(animationQueue, commit, gitVisuals) {
if (!animationQueue) {
throw new Error("Need animation queue to add closure to!");
}
var makeCommitBirthAnimation = function(gitVisuals, visNode) {
var time = GRAPHICS.defaultAnimationTime * 1.0;
var bounceTime = time * 2;
// essentially refresh the entire tree, but do a special thing for the commit
var visNode = commit.get('visNode');
var animation = function() {
// this takes care of refs and all that jazz, and updates all the positions
// essentially refresh the entire tree, but do a special thing for the commit
gitVisuals.refreshTree(time);
visNode.setBirth();
@ -41,13 +35,36 @@ AnimationFactory.prototype.genCommitBirthAnimation = function(animationQueue, co
visNode.animateUpdatedPosition(bounceTime, 'bounce');
visNode.animateOutgoingEdges(time);
};
return {
animation: animation,
duration: Math.max(time, bounceTime)
};
};
AnimationFactory.prototype.genCommitBirthAnimation = function(animationQueue, commit, gitVisuals) {
if (!animationQueue) {
throw new Error("Need animation queue to add closure to!");
}
var visNode = commit.get('visNode');
var anPack = makeCommitBirthAnimation(gitVisuals, visNode);
animationQueue.add(new Animation({
closure: animation,
duration: Math.max(time, bounceTime)
closure: anPack.animation,
duration: anPack.duration
}));
};
AnimationFactory.prototype.genCommitBirthPromiseAnimation = function(commit, gitVisuals) {
var visNode = commit.get('visNode');
var anPack = makeCommitBirthAnimation(gitVisuals, visNode);
console.log('my duration', anPack.duration);
return new PromiseAnimation({
closure: anPack.animation,
duration: anPack.duration
});
};
AnimationFactory.prototype.overrideOpacityDepth2 = function(attr, opacity) {
opacity = (opacity === undefined) ? 1 : opacity;