before headless fix, but not animation factory is static class

This commit is contained in:
Peter Cottle 2013-06-05 18:48:59 -10:00
parent a7e515dd8c
commit d0e206bcc4
4 changed files with 56 additions and 49 deletions

View file

@ -15,10 +15,8 @@ var GRAPHICS = require('../../util/constants').GRAPHICS;
* and then essentially animate the entire tree too.
*/
// essentially a static class
var AnimationFactory = function() {
};
// static class
var AnimationFactory = {};
var makeCommitBirthAnimation = function(gitVisuals, visNode) {
var time = GRAPHICS.defaultAnimationTime * 1.0;
@ -53,7 +51,7 @@ var makeHighlightAnimation = function(visNode, visBranch) {
};
};
AnimationFactory.prototype.genCommitBirthAnimation = function(animationQueue, commit, gitVisuals) {
AnimationFactory.genCommitBirthAnimation = function(animationQueue, commit, gitVisuals) {
if (!animationQueue) {
throw new Error("Need animation queue to add closure to!");
}
@ -67,12 +65,12 @@ AnimationFactory.prototype.genCommitBirthAnimation = function(animationQueue, co
}));
};
AnimationFactory.prototype.genCommitBirthPromiseAnimation = function(commit, gitVisuals) {
AnimationFactory.genCommitBirthPromiseAnimation = function(commit, gitVisuals) {
var visNode = commit.get('visNode');
return new PromiseAnimation(makeCommitBirthAnimation(gitVisuals, visNode));
};
AnimationFactory.prototype.highlightEachWithPromise = function(
AnimationFactory.highlightEachWithPromise = function(
chain,
toHighlight,
destObj
@ -88,13 +86,13 @@ AnimationFactory.prototype.highlightEachWithPromise = function(
return chain;
};
AnimationFactory.prototype.playCommitBirthPromiseAnimation = function(commit, gitVisuals) {
AnimationFactory.playCommitBirthPromiseAnimation = function(commit, gitVisuals) {
var animation = this.genCommitBirthPromiseAnimation(commit, gitVisuals);
animation.play();
return animation.getPromise();
};
AnimationFactory.prototype.playRefreshAnimationAndFinish = function(gitVisuals, animationQueue) {
AnimationFactory.playRefreshAnimationAndFinish = function(gitVisuals, animationQueue) {
var animation = new PromiseAnimation({
closure: function() {
gitVisuals.refreshTree();
@ -104,7 +102,7 @@ AnimationFactory.prototype.playRefreshAnimationAndFinish = function(gitVisuals,
animationQueue.thenFinish(animation.getPromise());
};
AnimationFactory.prototype.playRefreshAnimation = function(gitVisuals) {
AnimationFactory.playRefreshAnimation = function(gitVisuals) {
var animation = new PromiseAnimation({
closure: function() {
gitVisuals.refreshTree();
@ -114,7 +112,7 @@ AnimationFactory.prototype.playRefreshAnimation = function(gitVisuals) {
return animation.getPromise();
};
AnimationFactory.prototype.refreshTree = function(animationQueue, gitVisuals) {
AnimationFactory.refreshTree = function(animationQueue, gitVisuals) {
animationQueue.add(new Animation({
closure: function() {
gitVisuals.refreshTree();
@ -122,20 +120,20 @@ AnimationFactory.prototype.refreshTree = function(animationQueue, gitVisuals) {
}));
};
AnimationFactory.prototype.genHighlightPromiseAnimation = function(commit, destObj) {
AnimationFactory.genHighlightPromiseAnimation = function(commit, destObj) {
// could be branch or node
var visObj = destObj.get('visBranch') || destObj.get('visNode');
var visNode = commit.get('visNode');
return new PromiseAnimation(makeHighlightAnimation(visNode, visObj));
};
AnimationFactory.prototype.playHighlightPromiseAnimation = function(commit, destObj) {
AnimationFactory.playHighlightPromiseAnimation = function(commit, destObj) {
var animation = this.genHighlightPromiseAnimation(commit, destObj);
animation.play();
return animation.getPromise();
};
AnimationFactory.prototype.delay = function(animationQueue, time) {
AnimationFactory.delay = function(animationQueue, time) {
time = time || GRAPHICS.defaultAnimationTime;
animationQueue.add(new Animation({
closure: function() { },