BIG graphics update

This commit is contained in:
Peter Cottle 2012-09-17 11:22:45 -07:00
parent d16b8b61d3
commit cc65ae7491
4 changed files with 101 additions and 18 deletions

View file

@ -65,6 +65,7 @@ GitVisuals.prototype.toScreenCoords = function(pos) {
GitVisuals.prototype.refreshTree = function() {
this.calculateTreeCoords();
this.animateNodePositions();
this.animateEdges();
};
GitVisuals.prototype.calculateTreeCoords = function() {
@ -99,6 +100,8 @@ GitVisuals.prototype.assignBoundsRecursive = function(commit, min, max) {
// I always center myself within my bounds
var myWidthPos = (min + max) / 2.0;
commit.get('visNode').get('pos').x = myWidthPos;
// TODO get rid of
// commit.get('visNode').get('pos').x = Math.random();
if (commit.get('children').length == 0) {
return;
@ -137,6 +140,23 @@ GitVisuals.prototype.calcDepth = function() {
}, this);
};
/***************************************
== END Tree Calculation ==
_ __ __ _
\\/ / \ \//_
\ \ / __| __
\ \___/ /_____/ /
| _______ \
\ ( ) / \_\
\ /
| |
| |
____+-_=+-^ ^+-=_=__________
^^ I drew that :D
**************************************/
GitVisuals.prototype.animateNodePositions = function() {
_.each(this.visNodeMap, function(visNode) {
console.log(visNode);
@ -144,6 +164,12 @@ GitVisuals.prototype.animateNodePositions = function() {
}, this);
};
GitVisuals.prototype.animateEdges = function() {
this.edgeCollection.each(function(edge) {
edge.animateUpdatedPath();
}, this);
};
GitVisuals.prototype.getDepthIncrement = function(maxDepth) {
// assume there are at least 7 layers until later
maxDepth = Math.max(maxDepth, 7);