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) {
|
if (!animationQueue) {
|
||||||
throw new Error("Need animation queue to add closure to!");
|
throw new Error("Need animation queue to add closure to!");
|
||||||
}
|
}
|
||||||
|
@ -69,8 +69,7 @@ AnimationFactory.prototype.overrideOpacityDepth3 = function(snapShot, opacity) {
|
||||||
return newSnap;
|
return newSnap;
|
||||||
};
|
};
|
||||||
|
|
||||||
AnimationFactory.prototype.genCommitBirthClosureFromSnapshot = function(step) {
|
AnimationFactory.prototype.genCommitBirthClosureFromSnapshot = function(step, gitVisuals) {
|
||||||
|
|
||||||
var time = GRAPHICS.defaultAnimationTime * 1.0;
|
var time = GRAPHICS.defaultAnimationTime * 1.0;
|
||||||
var bounceTime = time * 1.5;
|
var bounceTime = time * 1.5;
|
||||||
|
|
||||||
|
@ -90,7 +89,7 @@ AnimationFactory.prototype.genCommitBirthClosureFromSnapshot = function(step) {
|
||||||
return animation;
|
return animation;
|
||||||
};
|
};
|
||||||
|
|
||||||
AnimationFactory.prototype.refreshTree = function(animationQueue) {
|
AnimationFactory.prototype.refreshTree = function(animationQueue, gitVisuals) {
|
||||||
animationQueue.add(new Animation({
|
animationQueue.add(new Animation({
|
||||||
closure: function() {
|
closure: function() {
|
||||||
gitVisuals.refreshTree();
|
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.rebaseHighlightPart(animationQueue, rebaseResponse, gitEngine);
|
||||||
this.rebaseBirthPart(animationQueue, rebaseResponse, gitEngine);
|
this.rebaseBirthPart(animationQueue, rebaseResponse, gitEngine, gitVisuals);
|
||||||
};
|
};
|
||||||
|
|
||||||
AnimationFactory.prototype.rebaseHighlightPart = function(animationQueue, rebaseResponse, gitEngine) {
|
AnimationFactory.prototype.rebaseHighlightPart = function(animationQueue, rebaseResponse, gitEngine) {
|
||||||
|
@ -130,7 +131,8 @@ AnimationFactory.prototype.rebaseHighlightPart = function(animationQueue, rebase
|
||||||
this.delay(animationQueue, fullTime * 2);
|
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 rebaseSteps = rebaseResponse.rebaseSteps;
|
||||||
|
|
||||||
var newVisNodes = [];
|
var newVisNodes = [];
|
||||||
|
@ -150,9 +152,10 @@ AnimationFactory.prototype.rebaseBirthPart = function(animationQueue, rebaseResp
|
||||||
rebaseStep.beforeSnapshot,
|
rebaseStep.beforeSnapshot,
|
||||||
rebaseStep.afterSnapshot,
|
rebaseStep.afterSnapshot,
|
||||||
toOmit,
|
toOmit,
|
||||||
previousVisNodes
|
previousVisNodes,
|
||||||
|
gitVisuals
|
||||||
);
|
);
|
||||||
var birthPart = this.genCommitBirthClosureFromSnapshot(rebaseStep);
|
var birthPart = this.genCommitBirthClosureFromSnapshot(rebaseStep, gitVisuals);
|
||||||
|
|
||||||
var animation = function() {
|
var animation = function() {
|
||||||
snapshotPart();
|
snapshotPart();
|
||||||
|
@ -214,7 +217,8 @@ AnimationFactory.prototype.genFromToSnapshotAnimation = function(
|
||||||
beforeSnapshot,
|
beforeSnapshot,
|
||||||
afterSnapshot,
|
afterSnapshot,
|
||||||
commitsToOmit,
|
commitsToOmit,
|
||||||
commitsToFixOpacity) {
|
commitsToFixOpacity,
|
||||||
|
gitVisuals) {
|
||||||
|
|
||||||
// we want to omit the commit outgoing edges
|
// we want to omit the commit outgoing edges
|
||||||
var toOmit = [];
|
var toOmit = [];
|
||||||
|
@ -244,3 +248,4 @@ AnimationFactory.prototype.genFromToSnapshotAnimation = function(
|
||||||
gitVisuals.animateAllFromAttrToAttr(beforeSnapshot, afterSnapshot, toOmit);
|
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);
|
var response = this.revert(this.generalArgs);
|
||||||
|
|
||||||
if (response) {
|
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);
|
newCommit.set('commitMessage', msg);
|
||||||
}
|
}
|
||||||
animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit);
|
animationFactory.genCommitBirthAnimation(this.animationQueue, newCommit, this.gitVisuals);
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.commit = function() {
|
GitEngine.prototype.commit = function() {
|
||||||
|
@ -832,7 +832,7 @@ GitEngine.prototype.rebaseStarter = function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
animationFactory.rebaseAnimation(this.animationQueue, response, this);
|
animationFactory.rebaseAnimation(this.animationQueue, response, this, this.gitVisuals);
|
||||||
};
|
};
|
||||||
|
|
||||||
GitEngine.prototype.rebase = function(targetSource, currentLocation) {
|
GitEngine.prototype.rebase = function(targetSource, currentLocation) {
|
||||||
|
@ -948,7 +948,7 @@ GitEngine.prototype.rebaseInteractive = function(targetSource, currentLocation)
|
||||||
|
|
||||||
// finish the rebase crap and animate!
|
// finish the rebase crap and animate!
|
||||||
var animationData = this.rebaseFinish(userSpecifiedRebase, {}, targetSource, currentLocation);
|
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.animationQueue.start();
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
@ -1049,7 +1049,7 @@ GitEngine.prototype.mergeStarter = function() {
|
||||||
|
|
||||||
if (newCommit === undefined) {
|
if (newCommit === undefined) {
|
||||||
// its just a fast forwrard
|
// its just a fast forwrard
|
||||||
animationFactory.refreshTree(this.animationQueue);
|
animationFactory.refreshTree(this.animationQueue, this.gitVisuals);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1261,11 +1261,7 @@ GitEngine.prototype.dispatch = function(command, callback) {
|
||||||
|
|
||||||
// only add the refresh if we didn't do manual animations
|
// only add the refresh if we didn't do manual animations
|
||||||
if (!this.animationQueue.get('animations').length && !this.animationQueue.get('defer')) {
|
if (!this.animationQueue.get('animations').length && !this.animationQueue.get('defer')) {
|
||||||
this.animationQueue.add(new Animation({
|
animationFactory.refreshTree(this.animationQueue, this.gitVisuals);
|
||||||
closure: function() {
|
|
||||||
this.gitVisuals.refreshTree();
|
|
||||||
}
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// animation queue will call the callback when its done
|
// animation queue will call the callback when its done
|
||||||
|
|
|
@ -20,12 +20,11 @@ var Visualization = Backbone.View.extend({
|
||||||
branchCollection: this.branchCollection
|
branchCollection: this.branchCollection
|
||||||
});
|
});
|
||||||
|
|
||||||
gitEngine = new GitEngine({
|
this.gitEngine = new GitEngine({
|
||||||
collection: this.commitCollection,
|
collection: this.commitCollection,
|
||||||
branches: this.branchCollection,
|
branches: this.branchCollection,
|
||||||
gitVisuals: this.gitVisuals
|
gitVisuals: this.gitVisuals
|
||||||
});
|
});
|
||||||
this.gitEngine = gitEngine;
|
|
||||||
this.gitVisuals.assignGitEngine(this.gitEngine);
|
this.gitVisuals.assignGitEngine(this.gitEngine);
|
||||||
|
|
||||||
// needs to be called before raphael ready
|
// needs to be called before raphael ready
|
||||||
|
@ -453,7 +452,6 @@ GitVisuals.prototype.addBranchFromEvent = function(branch, collection, index) {
|
||||||
};
|
};
|
||||||
|
|
||||||
GitVisuals.prototype.addBranch = function(branch, paperOverride) {
|
GitVisuals.prototype.addBranch = function(branch, paperOverride) {
|
||||||
// TODO
|
|
||||||
var visBranch = new VisBranch({
|
var visBranch = new VisBranch({
|
||||||
branch: branch,
|
branch: branch,
|
||||||
gitVisuals: this,
|
gitVisuals: this,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue