mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 00:18:56 +02:00
never thought i would see the DAYgit pushgit push! rebase animation fully working for all edge cases
This commit is contained in:
parent
6e30bedd37
commit
be2a5bf35b
4 changed files with 42 additions and 19 deletions
|
@ -114,10 +114,16 @@ AnimationFactory.prototype.rebaseAnimation = function(animationQueue, rebaseResp
|
||||||
visNode.setOutgoingEdgesOpacity(0);
|
visNode.setOutgoingEdgesOpacity(0);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
var previousVisNodes = [];
|
||||||
_.each(rebaseSteps, function(rebaseStep, index) {
|
_.each(rebaseSteps, function(rebaseStep, index) {
|
||||||
var toOmit = newVisNodes.slice(0, index).concat(newVisNodes.slice(index + 1));
|
var toOmit = newVisNodes.slice(index + 1);
|
||||||
|
|
||||||
var snapshotPart = this.genFromToSnapshotAnimation(rebaseStep.beforeSnapshot, rebaseStep.afterSnapshot, toOmit);
|
var snapshotPart = this.genFromToSnapshotAnimation(
|
||||||
|
rebaseStep.beforeSnapshot,
|
||||||
|
rebaseStep.afterSnapshot,
|
||||||
|
toOmit,
|
||||||
|
previousVisNodes
|
||||||
|
);
|
||||||
var birthPart = this.genCommitBirthClosureFromSnapshot(rebaseStep);
|
var birthPart = this.genCommitBirthClosureFromSnapshot(rebaseStep);
|
||||||
|
|
||||||
var animation = function() {
|
var animation = function() {
|
||||||
|
@ -127,7 +133,7 @@ AnimationFactory.prototype.rebaseAnimation = function(animationQueue, rebaseResp
|
||||||
|
|
||||||
animationQueue.add(new Animation({
|
animationQueue.add(new Animation({
|
||||||
closure: animation,
|
closure: animation,
|
||||||
duration: GRAPHICS.defaultAnimationTime
|
duration: GRAPHICS.defaultAnimationTime * 2
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -135,6 +141,7 @@ AnimationFactory.prototype.rebaseAnimation = function(animationQueue, rebaseResp
|
||||||
rebaseStep.newCommit
|
rebaseStep.newCommit
|
||||||
rebaseStep.beforeSnapshot
|
rebaseStep.beforeSnapshot
|
||||||
rebaseStep.afterSnapshot*/
|
rebaseStep.afterSnapshot*/
|
||||||
|
previousVisNodes.push(rebaseStep.newCommit.get('visNode'));
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
// need to delay to let bouncing finish
|
// need to delay to let bouncing finish
|
||||||
|
@ -180,17 +187,37 @@ AnimationFactory.prototype.stripObjectsFromSnapshot = function(snapShot, toOmit)
|
||||||
return newSnapshot;
|
return newSnapshot;
|
||||||
};
|
};
|
||||||
|
|
||||||
AnimationFactory.prototype.genFromToSnapshotAnimation = function(beforeSnapshot, afterSnapshot, commitsToOmit) {
|
AnimationFactory.prototype.genFromToSnapshotAnimation = function(
|
||||||
// we also want to omit the commit outgoing edges
|
beforeSnapshot,
|
||||||
|
afterSnapshot,
|
||||||
|
commitsToOmit,
|
||||||
|
commitsToFixOpacity) {
|
||||||
|
|
||||||
|
// we want to omit the commit outgoing edges
|
||||||
var toOmit = [];
|
var toOmit = [];
|
||||||
_.each(commitsToOmit, function(visNode) {
|
_.each(commitsToOmit, function(visNode) {
|
||||||
toOmit.push(visNode);
|
toOmit.push(visNode);
|
||||||
toOmit = toOmit.concat(visNode.get('outgoingEdges'));
|
toOmit = toOmit.concat(visNode.get('outgoingEdges'));
|
||||||
});
|
});
|
||||||
|
|
||||||
before = this.stripObjectsFromSnapshot(beforeSnapshot, toOmit);
|
var fixOpacity = function(obj) {
|
||||||
after = this.stripObjectsFromSnapshot(afterSnapshot, toOmit);
|
if (!obj) { return; }
|
||||||
|
_.each(obj, function(attr, partName) {
|
||||||
|
obj[partName].opacity = 1;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
// HORRIBLE loop to fix opacities all throughout the snapshot
|
||||||
|
_.each([beforeSnapshot, afterSnapshot], function(snapShot) {
|
||||||
|
_.each(commitsToFixOpacity, function(visNode) {
|
||||||
|
fixOpacity(snapShot[visNode.getID()]);
|
||||||
|
_.each(visNode.get('outgoingEdges'), function(visEdge) {
|
||||||
|
fixOpacity(snapShot[visEdge.getID()]);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return function() {
|
return function() {
|
||||||
gitVisuals.animateAllFromAttrToAttr(before, after);
|
gitVisuals.animateAllFromAttrToAttr(beforeSnapshot, afterSnapshot, toOmit);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,7 +19,7 @@ var GRAPHICS = {
|
||||||
nodeRadius: 17,
|
nodeRadius: 17,
|
||||||
curveControlPointOffset: 50,
|
curveControlPointOffset: 50,
|
||||||
defaultEasing: 'easeInOut',
|
defaultEasing: 'easeInOut',
|
||||||
defaultAnimationTime: 1000,
|
defaultAnimationTime: 400,
|
||||||
|
|
||||||
//rectFill: '#FF3A3A',
|
//rectFill: '#FF3A3A',
|
||||||
rectFill: 'hsb(0.8816909813322127,0.7,1)',
|
rectFill: 'hsb(0.8816909813322127,0.7,1)',
|
||||||
|
|
|
@ -64,11 +64,15 @@ GitVisuals.prototype.toScreenCoords = function(pos) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
GitVisuals.prototype.animateAllFromAttrToAttr = function(fromSnapshot, toSnapshot) {
|
GitVisuals.prototype.animateAllFromAttrToAttr = function(fromSnapshot, toSnapshot, idsToOmit) {
|
||||||
var animate = function(obj) {
|
var animate = function(obj) {
|
||||||
var id = obj.getID();
|
var id = obj.getID();
|
||||||
|
if (_.include(idsToOmit, id)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!fromSnapshot[id] || !toSnapshot[id]) {
|
if (!fromSnapshot[id] || !toSnapshot[id]) {
|
||||||
console.warn('this obj doesnt exist yet', id);
|
// its actually ok it doesnt exist yet
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
obj.animateFromAttrToAttr(fromSnapshot[id], toSnapshot[id]);
|
obj.animateFromAttrToAttr(fromSnapshot[id], toSnapshot[id]);
|
||||||
|
|
8
todo.txt
8
todo.txt
|
@ -8,25 +8,17 @@ animation factory? stuff like:
|
||||||
|
|
||||||
Big Graphic things:
|
Big Graphic things:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
- When you are rebasing and you hit the bottom, all the nodes go in the wrong spot...
|
|
||||||
|
|
||||||
- animateSnapshotFromTo(), then animate specific nodes
|
|
||||||
|
|
||||||
|
|
||||||
Medium things:
|
Medium things:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
- Rebuilding trees from a JSON snapshot / blob. this should be easy... i think. if we remove the need for parents
|
- Rebuilding trees from a JSON snapshot / blob. this should be easy... i think. if we remove the need for parents
|
||||||
- sizing on visedge arrowheads, also fill most likely
|
|
||||||
|
|
||||||
|
|
||||||
Small things to implement:
|
Small things to implement:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
Minor Bugs to fix:
|
Minor Bugs to fix:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
|
|
||||||
Big Bugs to fix:
|
Big Bugs to fix:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
- resolve core ID from alt Id's (C4''' becomes C4), and then skip those commits when rebasing. big
|
- resolve core ID from alt Id's (C4''' becomes C4), and then skip those commits when rebasing. big
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue