mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-09 22:24:26 +02:00
WIP on legend for goal
This commit is contained in:
parent
ea30b42616
commit
264f245275
11 changed files with 217 additions and 17 deletions
150
build/bundle.js
150
build/bundle.js
|
@ -6274,6 +6274,8 @@ var Level = Sandbox.extend({
|
|||
treeString: this.level.goalTreeString,
|
||||
noKeyboardInput: true,
|
||||
smallCanvas: true,
|
||||
isGoalVis: true,
|
||||
levelBlob: this.level,
|
||||
noClick: true
|
||||
});
|
||||
return this.goalCanvasHolder;
|
||||
|
@ -6772,6 +6774,7 @@ var Visualization = Backbone.View.extend({
|
|||
branchCollection: this.branchCollection,
|
||||
paper: this.paper,
|
||||
noClick: this.options.noClick,
|
||||
isGoalVis: this.options.isGoalVis,
|
||||
smallCanvas: this.options.smallCanvas,
|
||||
visualization: this
|
||||
});
|
||||
|
@ -9844,6 +9847,18 @@ TreeCompare.dispatchFromLevel = function(levelBlob, treeToCompare) {
|
|||
return TreeCompare.dispatch(levelBlob, goalTreeString, treeToCompare);
|
||||
};
|
||||
|
||||
TreeCompare.onlyMasterCompared = function(levelBlob) {
|
||||
var getAroundLintTrue = true;
|
||||
switch (getAroundLintTrue) {
|
||||
case !!levelBlob.compareOnlyMaster:
|
||||
case !!levelBlob.compareOnlyMasterHashAgnostic:
|
||||
case !!levelBlob.compareOnlyMasterHashAgnosticWithAsserts:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
TreeCompare.dispatch = function(levelBlob, goalTreeString, treeToCompare) {
|
||||
var getAroundLintTrue = true;
|
||||
// i actually prefer this to else if
|
||||
|
@ -15795,6 +15810,14 @@ GitVisuals.prototype.getFlipPos = function() {
|
|||
return this.flipFraction * (max - min) + min;
|
||||
};
|
||||
|
||||
GitVisuals.prototype.getIsGoalVis = function() {
|
||||
return !!this.options.isGoalVis;
|
||||
};
|
||||
|
||||
GitVisuals.prototype.getLevelBlob = function() {
|
||||
return this.visualization.options.levelBlob || {};
|
||||
};
|
||||
|
||||
GitVisuals.prototype.toScreenCoords = function(pos) {
|
||||
if (!this.paper.width) {
|
||||
throw new Error('being called too early for screen coords');
|
||||
|
@ -17032,6 +17055,7 @@ var Backbone = require('backbone');
|
|||
var GRAPHICS = require('../util/constants').GRAPHICS;
|
||||
|
||||
var VisBase = require('../visuals/visBase').VisBase;
|
||||
var TreeCompare = require('../git/treeCompare').TreeCompare;
|
||||
|
||||
var randomHueString = function() {
|
||||
var hue = Math.random();
|
||||
|
@ -17112,6 +17136,39 @@ var VisBranch = VisBase.extend({
|
|||
return visNode.getScreenCoords();
|
||||
},
|
||||
|
||||
getDashArray: function() {
|
||||
if (!this.get('gitVisuals').getIsGoalVis()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return (this.getIsLevelBranchCompared()) ? '' : '- ';
|
||||
},
|
||||
|
||||
getIsGoalAndNotCompared: function() {
|
||||
if (!this.get('gitVisuals').getIsGoalVis()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !this.getIsLevelBranchCompared();
|
||||
},
|
||||
|
||||
/**
|
||||
* returns true if we are a branch that is not being
|
||||
* compared in the goal (used in a goal visualization context
|
||||
*/
|
||||
getIsLevelBranchCompared: function() {
|
||||
if (this.getIsMaster()) {
|
||||
return true; // master always compared
|
||||
}
|
||||
// we are not master, so return true if its not just master being compared
|
||||
var levelBlob = this.get('gitVisuals').getLevelBlob();
|
||||
return !TreeCompare.onlyMasterCompared(levelBlob);
|
||||
},
|
||||
|
||||
getIsMaster: function() {
|
||||
return this.get('branch').get('id') == 'master';
|
||||
},
|
||||
|
||||
getFlipValue: function(commit, visNode) {
|
||||
var threshold = this.get('gitVisuals').getFlipPos();
|
||||
var overThreshold = (visNode.get('pos').x > threshold);
|
||||
|
@ -17467,13 +17524,22 @@ var VisBranch = VisBase.extend({
|
|||
if (this.get('isHead')) {
|
||||
return this.gitEngine.getDetachedHead() ? 1 : 0;
|
||||
}
|
||||
return this.getBranchStackIndex() === 0 ? 1 : 0.0;
|
||||
if (this.getBranchStackIndex() !== 0) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
},
|
||||
|
||||
getTextOpacity: function() {
|
||||
if (this.get('isHead')) {
|
||||
return this.gitEngine.getDetachedHead() ? 1 : 0;
|
||||
}
|
||||
|
||||
if (this.getIsGoalAndNotCompared()) {
|
||||
return 0.3;
|
||||
}
|
||||
|
||||
return 1;
|
||||
},
|
||||
|
||||
|
@ -17487,8 +17553,7 @@ var VisBranch = VisBase.extend({
|
|||
var rectSize = this.getRectSize();
|
||||
|
||||
var arrowPath = this.getArrowPath();
|
||||
var dashArray = (this.getIsInOrigin()) ?
|
||||
GRAPHICS.originDash : '';
|
||||
var dashArray = this.getDashArray();
|
||||
var cursorStyle = (this.shouldDisableClick()) ?
|
||||
'auto' :
|
||||
'pointer';
|
||||
|
@ -17510,7 +17575,7 @@ var VisBranch = VisBase.extend({
|
|||
opacity: nonTextOpacity,
|
||||
fill: this.getFill(),
|
||||
stroke: this.get('stroke'),
|
||||
//'stroke-dasharray': dashArray,
|
||||
'stroke-dasharray': dashArray,
|
||||
'stroke-width': this.get('stroke-width')
|
||||
},
|
||||
arrow: {
|
||||
|
@ -22462,10 +22527,12 @@ function getMockFactory() {
|
|||
mockFactory.playCommitBirthPromiseAnimation = function(commit, visuals) {
|
||||
var d = Q.defer();
|
||||
d.resolve();
|
||||
// return a resolved promise here
|
||||
return d.promise;
|
||||
};
|
||||
|
||||
mockFactory.highlightEachWithPromise = function(chain, toRebase, destBranch) {
|
||||
// dont add any steps
|
||||
return chain;
|
||||
};
|
||||
|
||||
|
@ -23499,10 +23566,12 @@ function getMockFactory() {
|
|||
mockFactory.playCommitBirthPromiseAnimation = function(commit, visuals) {
|
||||
var d = Q.defer();
|
||||
d.resolve();
|
||||
// return a resolved promise here
|
||||
return d.promise;
|
||||
};
|
||||
|
||||
mockFactory.highlightEachWithPromise = function(chain, toRebase, destBranch) {
|
||||
// dont add any steps
|
||||
return chain;
|
||||
};
|
||||
|
||||
|
@ -25974,6 +26043,18 @@ TreeCompare.dispatchFromLevel = function(levelBlob, treeToCompare) {
|
|||
return TreeCompare.dispatch(levelBlob, goalTreeString, treeToCompare);
|
||||
};
|
||||
|
||||
TreeCompare.onlyMasterCompared = function(levelBlob) {
|
||||
var getAroundLintTrue = true;
|
||||
switch (getAroundLintTrue) {
|
||||
case !!levelBlob.compareOnlyMaster:
|
||||
case !!levelBlob.compareOnlyMasterHashAgnostic:
|
||||
case !!levelBlob.compareOnlyMasterHashAgnosticWithAsserts:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
TreeCompare.dispatch = function(levelBlob, goalTreeString, treeToCompare) {
|
||||
var getAroundLintTrue = true;
|
||||
// i actually prefer this to else if
|
||||
|
@ -27759,6 +27840,8 @@ var Level = Sandbox.extend({
|
|||
treeString: this.level.goalTreeString,
|
||||
noKeyboardInput: true,
|
||||
smallCanvas: true,
|
||||
isGoalVis: true,
|
||||
levelBlob: this.level,
|
||||
noClick: true
|
||||
});
|
||||
return this.goalCanvasHolder;
|
||||
|
@ -32722,6 +32805,14 @@ GitVisuals.prototype.getFlipPos = function() {
|
|||
return this.flipFraction * (max - min) + min;
|
||||
};
|
||||
|
||||
GitVisuals.prototype.getIsGoalVis = function() {
|
||||
return !!this.options.isGoalVis;
|
||||
};
|
||||
|
||||
GitVisuals.prototype.getLevelBlob = function() {
|
||||
return this.visualization.options.levelBlob || {};
|
||||
};
|
||||
|
||||
GitVisuals.prototype.toScreenCoords = function(pos) {
|
||||
if (!this.paper.width) {
|
||||
throw new Error('being called too early for screen coords');
|
||||
|
@ -33568,6 +33659,7 @@ var Backbone = require('backbone');
|
|||
var GRAPHICS = require('../util/constants').GRAPHICS;
|
||||
|
||||
var VisBase = require('../visuals/visBase').VisBase;
|
||||
var TreeCompare = require('../git/treeCompare').TreeCompare;
|
||||
|
||||
var randomHueString = function() {
|
||||
var hue = Math.random();
|
||||
|
@ -33648,6 +33740,39 @@ var VisBranch = VisBase.extend({
|
|||
return visNode.getScreenCoords();
|
||||
},
|
||||
|
||||
getDashArray: function() {
|
||||
if (!this.get('gitVisuals').getIsGoalVis()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return (this.getIsLevelBranchCompared()) ? '' : '- ';
|
||||
},
|
||||
|
||||
getIsGoalAndNotCompared: function() {
|
||||
if (!this.get('gitVisuals').getIsGoalVis()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !this.getIsLevelBranchCompared();
|
||||
},
|
||||
|
||||
/**
|
||||
* returns true if we are a branch that is not being
|
||||
* compared in the goal (used in a goal visualization context
|
||||
*/
|
||||
getIsLevelBranchCompared: function() {
|
||||
if (this.getIsMaster()) {
|
||||
return true; // master always compared
|
||||
}
|
||||
// we are not master, so return true if its not just master being compared
|
||||
var levelBlob = this.get('gitVisuals').getLevelBlob();
|
||||
return !TreeCompare.onlyMasterCompared(levelBlob);
|
||||
},
|
||||
|
||||
getIsMaster: function() {
|
||||
return this.get('branch').get('id') == 'master';
|
||||
},
|
||||
|
||||
getFlipValue: function(commit, visNode) {
|
||||
var threshold = this.get('gitVisuals').getFlipPos();
|
||||
var overThreshold = (visNode.get('pos').x > threshold);
|
||||
|
@ -34003,13 +34128,22 @@ var VisBranch = VisBase.extend({
|
|||
if (this.get('isHead')) {
|
||||
return this.gitEngine.getDetachedHead() ? 1 : 0;
|
||||
}
|
||||
return this.getBranchStackIndex() === 0 ? 1 : 0.0;
|
||||
if (this.getBranchStackIndex() !== 0) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
},
|
||||
|
||||
getTextOpacity: function() {
|
||||
if (this.get('isHead')) {
|
||||
return this.gitEngine.getDetachedHead() ? 1 : 0;
|
||||
}
|
||||
|
||||
if (this.getIsGoalAndNotCompared()) {
|
||||
return 0.3;
|
||||
}
|
||||
|
||||
return 1;
|
||||
},
|
||||
|
||||
|
@ -34023,8 +34157,7 @@ var VisBranch = VisBase.extend({
|
|||
var rectSize = this.getRectSize();
|
||||
|
||||
var arrowPath = this.getArrowPath();
|
||||
var dashArray = (this.getIsInOrigin()) ?
|
||||
GRAPHICS.originDash : '';
|
||||
var dashArray = this.getDashArray();
|
||||
var cursorStyle = (this.shouldDisableClick()) ?
|
||||
'auto' :
|
||||
'pointer';
|
||||
|
@ -34046,7 +34179,7 @@ var VisBranch = VisBase.extend({
|
|||
opacity: nonTextOpacity,
|
||||
fill: this.getFill(),
|
||||
stroke: this.get('stroke'),
|
||||
//'stroke-dasharray': dashArray,
|
||||
'stroke-dasharray': dashArray,
|
||||
'stroke-width': this.get('stroke-width')
|
||||
},
|
||||
arrow: {
|
||||
|
@ -34771,6 +34904,7 @@ var Visualization = Backbone.View.extend({
|
|||
branchCollection: this.branchCollection,
|
||||
paper: this.paper,
|
||||
noClick: this.options.noClick,
|
||||
isGoalVis: this.options.isGoalVis,
|
||||
smallCanvas: this.options.smallCanvas,
|
||||
visualization: this
|
||||
});
|
||||
|
|
File diff suppressed because one or more lines are too long
1
build/bundle.min.js
vendored
1
build/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -434,7 +434,7 @@
|
|||
For a much easier time perusing the source, see the individual files at:
|
||||
https://github.com/pcottle/learnGitBranching
|
||||
-->
|
||||
<script src="build/bundle.min.ad27f098.js"></script>
|
||||
<script src="build/bundle.js"></script>
|
||||
|
||||
<!-- The advantage of github pages: super-easy, simple, slick static hostic.
|
||||
The downside? No raw logs to parse for analytics, so I have to include
|
||||
|
|
|
@ -32,10 +32,12 @@ function getMockFactory() {
|
|||
mockFactory.playCommitBirthPromiseAnimation = function(commit, visuals) {
|
||||
var d = Q.defer();
|
||||
d.resolve();
|
||||
// return a resolved promise here
|
||||
return d.promise;
|
||||
};
|
||||
|
||||
mockFactory.highlightEachWithPromise = function(chain, toRebase, destBranch) {
|
||||
// dont add any steps
|
||||
return chain;
|
||||
};
|
||||
|
||||
|
|
|
@ -8,6 +8,18 @@ TreeCompare.dispatchFromLevel = function(levelBlob, treeToCompare) {
|
|||
return TreeCompare.dispatch(levelBlob, goalTreeString, treeToCompare);
|
||||
};
|
||||
|
||||
TreeCompare.onlyMasterCompared = function(levelBlob) {
|
||||
var getAroundLintTrue = true;
|
||||
switch (getAroundLintTrue) {
|
||||
case !!levelBlob.compareOnlyMaster:
|
||||
case !!levelBlob.compareOnlyMasterHashAgnostic:
|
||||
case !!levelBlob.compareOnlyMasterHashAgnosticWithAsserts:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
TreeCompare.dispatch = function(levelBlob, goalTreeString, treeToCompare) {
|
||||
var getAroundLintTrue = true;
|
||||
// i actually prefer this to else if
|
||||
|
|
|
@ -177,6 +177,8 @@ var Level = Sandbox.extend({
|
|||
treeString: this.level.goalTreeString,
|
||||
noKeyboardInput: true,
|
||||
smallCanvas: true,
|
||||
isGoalVis: true,
|
||||
levelBlob: this.level,
|
||||
noClick: true
|
||||
});
|
||||
return this.goalCanvasHolder;
|
||||
|
|
|
@ -141,6 +141,14 @@ GitVisuals.prototype.getFlipPos = function() {
|
|||
return this.flipFraction * (max - min) + min;
|
||||
};
|
||||
|
||||
GitVisuals.prototype.getIsGoalVis = function() {
|
||||
return !!this.options.isGoalVis;
|
||||
};
|
||||
|
||||
GitVisuals.prototype.getLevelBlob = function() {
|
||||
return this.visualization.options.levelBlob || {};
|
||||
};
|
||||
|
||||
GitVisuals.prototype.toScreenCoords = function(pos) {
|
||||
if (!this.paper.width) {
|
||||
throw new Error('being called too early for screen coords');
|
||||
|
|
|
@ -3,6 +3,7 @@ var Backbone = require('backbone');
|
|||
var GRAPHICS = require('../util/constants').GRAPHICS;
|
||||
|
||||
var VisBase = require('../visuals/visBase').VisBase;
|
||||
var TreeCompare = require('../git/treeCompare').TreeCompare;
|
||||
|
||||
var randomHueString = function() {
|
||||
var hue = Math.random();
|
||||
|
@ -83,6 +84,39 @@ var VisBranch = VisBase.extend({
|
|||
return visNode.getScreenCoords();
|
||||
},
|
||||
|
||||
getDashArray: function() {
|
||||
if (!this.get('gitVisuals').getIsGoalVis()) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return (this.getIsLevelBranchCompared()) ? '' : '- ';
|
||||
},
|
||||
|
||||
getIsGoalAndNotCompared: function() {
|
||||
if (!this.get('gitVisuals').getIsGoalVis()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !this.getIsLevelBranchCompared();
|
||||
},
|
||||
|
||||
/**
|
||||
* returns true if we are a branch that is not being
|
||||
* compared in the goal (used in a goal visualization context
|
||||
*/
|
||||
getIsLevelBranchCompared: function() {
|
||||
if (this.getIsMaster()) {
|
||||
return true; // master always compared
|
||||
}
|
||||
// we are not master, so return true if its not just master being compared
|
||||
var levelBlob = this.get('gitVisuals').getLevelBlob();
|
||||
return !TreeCompare.onlyMasterCompared(levelBlob);
|
||||
},
|
||||
|
||||
getIsMaster: function() {
|
||||
return this.get('branch').get('id') == 'master';
|
||||
},
|
||||
|
||||
getFlipValue: function(commit, visNode) {
|
||||
var threshold = this.get('gitVisuals').getFlipPos();
|
||||
var overThreshold = (visNode.get('pos').x > threshold);
|
||||
|
@ -438,13 +472,22 @@ var VisBranch = VisBase.extend({
|
|||
if (this.get('isHead')) {
|
||||
return this.gitEngine.getDetachedHead() ? 1 : 0;
|
||||
}
|
||||
return this.getBranchStackIndex() === 0 ? 1 : 0.0;
|
||||
if (this.getBranchStackIndex() !== 0) {
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
},
|
||||
|
||||
getTextOpacity: function() {
|
||||
if (this.get('isHead')) {
|
||||
return this.gitEngine.getDetachedHead() ? 1 : 0;
|
||||
}
|
||||
|
||||
if (this.getIsGoalAndNotCompared()) {
|
||||
return 0.3;
|
||||
}
|
||||
|
||||
return 1;
|
||||
},
|
||||
|
||||
|
@ -458,8 +501,7 @@ var VisBranch = VisBase.extend({
|
|||
var rectSize = this.getRectSize();
|
||||
|
||||
var arrowPath = this.getArrowPath();
|
||||
var dashArray = (this.getIsInOrigin()) ?
|
||||
GRAPHICS.originDash : '';
|
||||
var dashArray = this.getDashArray();
|
||||
var cursorStyle = (this.shouldDisableClick()) ?
|
||||
'auto' :
|
||||
'pointer';
|
||||
|
@ -481,7 +523,7 @@ var VisBranch = VisBase.extend({
|
|||
opacity: nonTextOpacity,
|
||||
fill: this.getFill(),
|
||||
stroke: this.get('stroke'),
|
||||
//'stroke-dasharray': dashArray,
|
||||
'stroke-dasharray': dashArray,
|
||||
'stroke-width': this.get('stroke-width')
|
||||
},
|
||||
arrow: {
|
||||
|
|
|
@ -49,6 +49,7 @@ var Visualization = Backbone.View.extend({
|
|||
branchCollection: this.branchCollection,
|
||||
paper: this.paper,
|
||||
noClick: this.options.noClick,
|
||||
isGoalVis: this.options.isGoalVis,
|
||||
smallCanvas: this.options.smallCanvas,
|
||||
visualization: this
|
||||
});
|
||||
|
|
5
todo.txt
5
todo.txt
|
@ -4,10 +4,9 @@ Mega Things
|
|||
|
||||
Before everything else:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
[ ] fix tests by stubbing out animation factory to resolve promises
|
||||
[ ] increase test coverage over everything
|
||||
- unit and integration, but mostly for git operations
|
||||
[ ] green refactor level compare
|
||||
[ ] green refactor tree compare to have map
|
||||
|
||||
Intl TODO
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
|
@ -35,6 +34,7 @@ Origin things:
|
|||
|
||||
Medium things:
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
[ ] add visuals and text to show compare method
|
||||
|
||||
Cases to handle / things to edit
|
||||
=======================
|
||||
|
@ -54,6 +54,7 @@ Ideas for cleaning
|
|||
Done things:
|
||||
(I only started this on Dec 17th 2012 to get a better sense of what was done)
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
[x] fix tests by stubbing out animation factory to resolve promises
|
||||
[x] better git clone and fake teamwork anywhere
|
||||
[x] git pull animation
|
||||
[x] use the graph difference algorithm to then implement git push
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue