mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 00:18:56 +02:00
gitvisuals in animation
This commit is contained in:
parent
38b0512bca
commit
a009b9783a
3 changed files with 22 additions and 23 deletions
|
@ -13,7 +13,7 @@ function AnimationFactory() {
|
|||
|
||||
}
|
||||
|
||||
AnimationFactory.prototype.genCommitBirthAnimation = function(animationQueue, commit) {
|
||||
AnimationFactory.prototype.genCommitBirthAnimation = function(animationQueue, commit, gitVisuals) {
|
||||
if (!animationQueue) {
|
||||
throw new Error("Need animation queue to add closure to!");
|
||||
}
|
||||
|
@ -69,8 +69,7 @@ AnimationFactory.prototype.overrideOpacityDepth3 = function(snapShot, opacity) {
|
|||
return newSnap;
|
||||
};
|
||||
|
||||
AnimationFactory.prototype.genCommitBirthClosureFromSnapshot = function(step) {
|
||||
|
||||
AnimationFactory.prototype.genCommitBirthClosureFromSnapshot = function(step, gitVisuals) {
|
||||
var time = GRAPHICS.defaultAnimationTime * 1.0;
|
||||
var bounceTime = time * 1.5;
|
||||
|
||||
|
@ -90,7 +89,7 @@ AnimationFactory.prototype.genCommitBirthClosureFromSnapshot = function(step) {
|
|||
return animation;
|
||||
};
|
||||
|
||||
AnimationFactory.prototype.refreshTree = function(animationQueue) {
|
||||
AnimationFactory.prototype.refreshTree = function(animationQueue, gitVisuals) {
|
||||
animationQueue.add(new Animation({
|
||||
closure: function() {
|
||||
gitVisuals.refreshTree();
|
||||
|
@ -98,9 +97,11 @@ AnimationFactory.prototype.refreshTree = function(animationQueue) {
|
|||
}));
|
||||
};
|
||||
|
||||
AnimationFactory.prototype.rebaseAnimation = function(animationQueue, rebaseResponse, gitEngine) {
|
||||
AnimationFactory.prototype.rebaseAnimation = function(animationQueue, rebaseResponse,
|
||||
gitEngine, gitVisuals) {
|
||||
|
||||
this.rebaseHighlightPart(animationQueue, rebaseResponse, gitEngine);
|
||||
this.rebaseBirthPart(animationQueue, rebaseResponse, gitEngine);
|
||||
this.rebaseBirthPart(animationQueue, rebaseResponse, gitEngine, gitVisuals);
|
||||
};
|
||||
|
||||
AnimationFactory.prototype.rebaseHighlightPart = function(animationQueue, rebaseResponse, gitEngine) {
|
||||
|
@ -130,7 +131,8 @@ AnimationFactory.prototype.rebaseHighlightPart = function(animationQueue, rebase
|
|||
this.delay(animationQueue, fullTime * 2);
|
||||
};
|
||||
|
||||
AnimationFactory.prototype.rebaseBirthPart = function(animationQueue, rebaseResponse, gitEngine) {
|
||||
AnimationFactory.prototype.rebaseBirthPart = function(animationQueue, rebaseResponse,
|
||||
gitEngine, gitVisuals) {
|
||||
var rebaseSteps = rebaseResponse.rebaseSteps;
|
||||
|
||||
var newVisNodes = [];
|
||||
|
@ -150,9 +152,10 @@ AnimationFactory.prototype.rebaseBirthPart = function(animationQueue, rebaseResp
|
|||
rebaseStep.beforeSnapshot,
|
||||
rebaseStep.afterSnapshot,
|
||||
toOmit,
|
||||
previousVisNodes
|
||||
previousVisNodes,
|
||||
gitVisuals
|
||||
);
|
||||
var birthPart = this.genCommitBirthClosureFromSnapshot(rebaseStep);
|
||||
var birthPart = this.genCommitBirthClosureFromSnapshot(rebaseStep, gitVisuals);
|
||||
|
||||
var animation = function() {
|
||||
snapshotPart();
|
||||
|
@ -214,7 +217,8 @@ AnimationFactory.prototype.genFromToSnapshotAnimation = function(
|
|||
beforeSnapshot,
|
||||
afterSnapshot,
|
||||
commitsToOmit,
|
||||
commitsToFixOpacity) {
|
||||
commitsToFixOpacity,
|
||||
gitVisuals) {
|
||||
|
||||
// we want to omit the commit outgoing edges
|
||||
var toOmit = [];
|
||||
|
@ -244,3 +248,4 @@ AnimationFactory.prototype.genFromToSnapshotAnimation = function(
|
|||
gitVisuals.animateAllFromAttrToAttr(beforeSnapshot, afterSnapshot, toOmit);
|
||||
};
|
||||
};
|
||||
|
||||
|
|
16
src/git.js
16
src/git.js
|
@ -375,7 +375,7 @@ GitEngine.prototype.revertStarter = function() {
|
|||
var response = this.revert(this.generalArgs);
|
||||
|
||||
if (response) {
|
||||
animationFactory.rebaseAnimation(this.animationQueue, response, this);
|
||||
animationFactory.rebaseAnimation(this.animationQueue, response, this, this.gitVisuals);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -496,7 +496,7 @@ GitEngine.prototype.commitStarter = function() {
|
|||
|
||||
newCommit.set('commitMessage', msg);
|
||||
}
|
||||
animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit);
|
||||
animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals);
|
||||
};
|
||||
|
||||
GitEngine.prototype.commit = function() {
|
||||
|
@ -832,7 +832,7 @@ GitEngine.prototype.rebaseStarter = function() {
|
|||
return;
|
||||
}
|
||||
|
||||
animationFactory.rebaseAnimation(this.animationQueue, response, this);
|
||||
animationFactory.rebaseAnimation(this.animationQueue, response, this, this.gitVisuals);
|
||||
};
|
||||
|
||||
GitEngine.prototype.rebase = function(targetSource, currentLocation) {
|
||||
|
@ -948,7 +948,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);
|
||||
animationFactory.rebaseAnimation(this.animationQueue, animationData, this, this.gitVisuals);
|
||||
this.animationQueue.start();
|
||||
}, this);
|
||||
|
||||
|
@ -1049,7 +1049,7 @@ GitEngine.prototype.mergeStarter = function() {
|
|||
|
||||
if (newCommit === undefined) {
|
||||
// its just a fast forwrard
|
||||
animationFactory.refreshTree(this.animationQueue);
|
||||
animationFactory.refreshTree(this.animationQueue, this.gitVisuals);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1261,11 +1261,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')) {
|
||||
this.animationQueue.add(new Animation({
|
||||
closure: function() {
|
||||
this.gitVisuals.refreshTree();
|
||||
}
|
||||
}));
|
||||
animationFactory.refreshTree(this.animationQueue, this.gitVisuals);
|
||||
}
|
||||
|
||||
// animation queue will call the callback when its done
|
||||
|
|
|
@ -20,12 +20,11 @@ var Visualization = Backbone.View.extend({
|
|||
branchCollection: this.branchCollection
|
||||
});
|
||||
|
||||
gitEngine = new GitEngine({
|
||||
this.gitEngine = new GitEngine({
|
||||
collection: this.commitCollection,
|
||||
branches: this.branchCollection,
|
||||
gitVisuals: this.gitVisuals
|
||||
});
|
||||
this.gitEngine = gitEngine;
|
||||
this.gitVisuals.assignGitEngine(this.gitEngine);
|
||||
|
||||
// needs to be called before raphael ready
|
||||
|
@ -453,7 +452,6 @@ GitVisuals.prototype.addBranchFromEvent = function(branch, collection, index) {
|
|||
};
|
||||
|
||||
GitVisuals.prototype.addBranch = function(branch, paperOverride) {
|
||||
// TODO
|
||||
var visBranch = new VisBranch({
|
||||
branch: branch,
|
||||
gitVisuals: this,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue