working on origin

This commit is contained in:
Peter Cottle 2013-05-13 10:01:41 -07:00
parent da53aabe13
commit dd9f05eaa3
6 changed files with 97 additions and 30 deletions

View file

@ -38,11 +38,6 @@ function GitVisuals(options) {
this.branchCollection.on('remove', this.removeBranch, this);
this.deferred = [];
// eventually have origin support here
this.posBoundaries = {
min: 0,
max: 1
};
this.flipFraction = 0.65;
var Main = require('../app');
@ -116,9 +111,28 @@ GitVisuals.prototype.getScreenPadding = function() {
};
};
GitVisuals.prototype.getPosBoundaries = function() {
if (this.gitEngine.hasOrigin()) {
return {
min: 0,
max: 0.5
};
} else if (this.gitEngine.isOrigin()) {
return {
min: 0.5,
max: 1
};
}
return {
min: 0,
max: 1
};
};
GitVisuals.prototype.getFlipPos = function() {
var min = this.posBoundaries.min;
var max = this.posBoundaries.max;
var bounds = this.getPosBoundaries();
var min = bounds.min;
var max = bounds.max;
return this.flipFraction * (max - min) + min;
};
@ -472,10 +486,11 @@ GitVisuals.prototype.calcBranchStacks = function() {
GitVisuals.prototype.calcWidth = function() {
this.maxWidthRecursive(this.rootCommit);
var bounds = this.getPosBoundaries();
this.assignBoundsRecursive(
this.rootCommit,
this.posBoundaries.min,
this.posBoundaries.max
bounds.min,
bounds.max
);
};