From 7722114fb08eaa44927a2bf093f2255b3e1940a7 Mon Sep 17 00:00:00 2001 From: Peter Cottle Date: Sat, 15 Dec 2012 23:38:50 -0800 Subject: [PATCH] animation factory now a this --- build/bundle.js | 38 ++++++++++++++++++++------------------ src/js/git/index.js | 19 ++++++++++--------- 2 files changed, 30 insertions(+), 27 deletions(-) diff --git a/build/bundle.js b/build/bundle.js index 8cb9a523..a23c9b45 100644 --- a/build/bundle.js +++ b/build/bundle.js @@ -1238,7 +1238,6 @@ exports.CommandBuffer = CommandBuffer; }); require.define("/git/index.js",function(require,module,exports,__dirname,__filename,process,global){var AnimationFactoryModule = require('../visuals/animation/animationFactory'); -var animationFactory = new AnimationFactoryModule.AnimationFactory(); var Main = require('../app'); var AnimationQueue = require('../visuals/animation').AnimationQueue; var InteractiveRebaseView = require('../views/miscViews').InteractiveRebaseView; @@ -1263,6 +1262,8 @@ function GitEngine(options) { this.branchCollection = options.branches; this.commitCollection = options.collection; this.gitVisuals = options.gitVisuals; + this.animationFactory = options.animationFactory || + new AnimationFactoryModule.AnimationFactory(); // global variable to keep track of the options given // along with the command call. @@ -1646,7 +1647,7 @@ GitEngine.prototype.revertStarter = function() { var response = this.revert(this.generalArgs); if (response) { - animationFactory.rebaseAnimation(this.animationQueue, response, this, this.gitVisuals); + this.animationFactory.rebaseAnimation(this.animationQueue, response, this, this.gitVisuals); } }; @@ -1732,7 +1733,7 @@ GitEngine.prototype.cherrypickStarter = function() { this.validateArgBounds(this.generalArgs, 1, 1); var newCommit = this.cherrypick(this.generalArgs[0]); - animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); + this.animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); }; GitEngine.prototype.cherrypick = function(ref) { @@ -1795,7 +1796,7 @@ GitEngine.prototype.commitStarter = function() { newCommit.set('commitMessage', msg); } - animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); + this.animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); }; GitEngine.prototype.commit = function() { @@ -2132,7 +2133,7 @@ GitEngine.prototype.rebaseStarter = function() { return; } - animationFactory.rebaseAnimation(this.animationQueue, response, this, this.gitVisuals); + this.animationFactory.rebaseAnimation(this.animationQueue, response, this, this.gitVisuals); }; GitEngine.prototype.rebase = function(targetSource, currentLocation) { @@ -2248,7 +2249,7 @@ GitEngine.prototype.rebaseInteractive = function(targetSource, currentLocation) // finish the rebase crap and animate! var animationData = this.rebaseFinish(userSpecifiedRebase, {}, targetSource, currentLocation); - animationFactory.rebaseAnimation(this.animationQueue, animationData, this, this.gitVisuals); + this.animationFactory.rebaseAnimation(this.animationQueue, animationData, this, this.gitVisuals); this.animationQueue.start(); }, this); @@ -2349,11 +2350,11 @@ GitEngine.prototype.mergeStarter = function() { if (newCommit === undefined) { // its just a fast forwrard - animationFactory.refreshTree(this.animationQueue, this.gitVisuals); + this.animationFactory.refreshTree(this.animationQueue, this.gitVisuals); return; } - animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); + this.animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); }; GitEngine.prototype.merge = function(targetSource, currentLocation) { @@ -2583,7 +2584,7 @@ GitEngine.prototype.dispatch = function(command, callback) { // only add the refresh if we didn't do manual animations if (!this.animationQueue.get('animations').length && !this.animationQueue.get('defer')) { - animationFactory.refreshTree(this.animationQueue, this.gitVisuals); + this.animationFactory.refreshTree(this.animationQueue, this.gitVisuals); } // animation queue will call the callback when its done @@ -5362,7 +5363,6 @@ exports.getUI = function() { require("/app/index.js"); require.define("/git/index.js",function(require,module,exports,__dirname,__filename,process,global){var AnimationFactoryModule = require('../visuals/animation/animationFactory'); -var animationFactory = new AnimationFactoryModule.AnimationFactory(); var Main = require('../app'); var AnimationQueue = require('../visuals/animation').AnimationQueue; var InteractiveRebaseView = require('../views/miscViews').InteractiveRebaseView; @@ -5387,6 +5387,8 @@ function GitEngine(options) { this.branchCollection = options.branches; this.commitCollection = options.collection; this.gitVisuals = options.gitVisuals; + this.animationFactory = options.animationFactory || + new AnimationFactoryModule.AnimationFactory(); // global variable to keep track of the options given // along with the command call. @@ -5770,7 +5772,7 @@ GitEngine.prototype.revertStarter = function() { var response = this.revert(this.generalArgs); if (response) { - animationFactory.rebaseAnimation(this.animationQueue, response, this, this.gitVisuals); + this.animationFactory.rebaseAnimation(this.animationQueue, response, this, this.gitVisuals); } }; @@ -5856,7 +5858,7 @@ GitEngine.prototype.cherrypickStarter = function() { this.validateArgBounds(this.generalArgs, 1, 1); var newCommit = this.cherrypick(this.generalArgs[0]); - animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); + this.animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); }; GitEngine.prototype.cherrypick = function(ref) { @@ -5919,7 +5921,7 @@ GitEngine.prototype.commitStarter = function() { newCommit.set('commitMessage', msg); } - animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); + this.animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); }; GitEngine.prototype.commit = function() { @@ -6256,7 +6258,7 @@ GitEngine.prototype.rebaseStarter = function() { return; } - animationFactory.rebaseAnimation(this.animationQueue, response, this, this.gitVisuals); + this.animationFactory.rebaseAnimation(this.animationQueue, response, this, this.gitVisuals); }; GitEngine.prototype.rebase = function(targetSource, currentLocation) { @@ -6372,7 +6374,7 @@ GitEngine.prototype.rebaseInteractive = function(targetSource, currentLocation) // finish the rebase crap and animate! var animationData = this.rebaseFinish(userSpecifiedRebase, {}, targetSource, currentLocation); - animationFactory.rebaseAnimation(this.animationQueue, animationData, this, this.gitVisuals); + this.animationFactory.rebaseAnimation(this.animationQueue, animationData, this, this.gitVisuals); this.animationQueue.start(); }, this); @@ -6473,11 +6475,11 @@ GitEngine.prototype.mergeStarter = function() { if (newCommit === undefined) { // its just a fast forwrard - animationFactory.refreshTree(this.animationQueue, this.gitVisuals); + this.animationFactory.refreshTree(this.animationQueue, this.gitVisuals); return; } - animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); + this.animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); }; GitEngine.prototype.merge = function(targetSource, currentLocation) { @@ -6707,7 +6709,7 @@ GitEngine.prototype.dispatch = function(command, callback) { // only add the refresh if we didn't do manual animations if (!this.animationQueue.get('animations').length && !this.animationQueue.get('defer')) { - animationFactory.refreshTree(this.animationQueue, this.gitVisuals); + this.animationFactory.refreshTree(this.animationQueue, this.gitVisuals); } // animation queue will call the callback when its done diff --git a/src/js/git/index.js b/src/js/git/index.js index 228a09a2..12665b5d 100644 --- a/src/js/git/index.js +++ b/src/js/git/index.js @@ -1,5 +1,4 @@ var AnimationFactoryModule = require('../visuals/animation/animationFactory'); -var animationFactory = new AnimationFactoryModule.AnimationFactory(); var Main = require('../app'); var AnimationQueue = require('../visuals/animation').AnimationQueue; var InteractiveRebaseView = require('../views/miscViews').InteractiveRebaseView; @@ -24,6 +23,8 @@ function GitEngine(options) { this.branchCollection = options.branches; this.commitCollection = options.collection; this.gitVisuals = options.gitVisuals; + this.animationFactory = options.animationFactory || + new AnimationFactoryModule.AnimationFactory(); // global variable to keep track of the options given // along with the command call. @@ -407,7 +408,7 @@ GitEngine.prototype.revertStarter = function() { var response = this.revert(this.generalArgs); if (response) { - animationFactory.rebaseAnimation(this.animationQueue, response, this, this.gitVisuals); + this.animationFactory.rebaseAnimation(this.animationQueue, response, this, this.gitVisuals); } }; @@ -493,7 +494,7 @@ GitEngine.prototype.cherrypickStarter = function() { this.validateArgBounds(this.generalArgs, 1, 1); var newCommit = this.cherrypick(this.generalArgs[0]); - animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); + this.animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); }; GitEngine.prototype.cherrypick = function(ref) { @@ -556,7 +557,7 @@ GitEngine.prototype.commitStarter = function() { newCommit.set('commitMessage', msg); } - animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); + this.animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); }; GitEngine.prototype.commit = function() { @@ -893,7 +894,7 @@ GitEngine.prototype.rebaseStarter = function() { return; } - animationFactory.rebaseAnimation(this.animationQueue, response, this, this.gitVisuals); + this.animationFactory.rebaseAnimation(this.animationQueue, response, this, this.gitVisuals); }; GitEngine.prototype.rebase = function(targetSource, currentLocation) { @@ -1009,7 +1010,7 @@ GitEngine.prototype.rebaseInteractive = function(targetSource, currentLocation) // finish the rebase crap and animate! var animationData = this.rebaseFinish(userSpecifiedRebase, {}, targetSource, currentLocation); - animationFactory.rebaseAnimation(this.animationQueue, animationData, this, this.gitVisuals); + this.animationFactory.rebaseAnimation(this.animationQueue, animationData, this, this.gitVisuals); this.animationQueue.start(); }, this); @@ -1110,11 +1111,11 @@ GitEngine.prototype.mergeStarter = function() { if (newCommit === undefined) { // its just a fast forwrard - animationFactory.refreshTree(this.animationQueue, this.gitVisuals); + this.animationFactory.refreshTree(this.animationQueue, this.gitVisuals); return; } - animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); + this.animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals); }; GitEngine.prototype.merge = function(targetSource, currentLocation) { @@ -1344,7 +1345,7 @@ GitEngine.prototype.dispatch = function(command, callback) { // only add the refresh if we didn't do manual animations if (!this.animationQueue.get('animations').length && !this.animationQueue.get('defer')) { - animationFactory.refreshTree(this.animationQueue, this.gitVisuals); + this.animationFactory.refreshTree(this.animationQueue, this.gitVisuals); } // animation queue will call the callback when its done