nicer preview working on assertions

This commit is contained in:
Peter Cottle 2013-03-09 21:08:36 -08:00
parent 092a92b0b4
commit 5754238864
7 changed files with 69 additions and 15 deletions

View file

@ -14946,21 +14946,37 @@ GitVisuals.prototype.assignBoundsRecursive = function(commit, min, max) {
} }
}, this); }, this);
var prevBound = min; var checkPortion = function(portion, index) {
if (myLength < 0.99 || children.length < 2) {
return portion;
}
// we introduce a VERY specific rule here, to push out
// the first "divergence" of the graph
if (index === 0) {
portion *= 1/3;
} else if (index === children.length - 1) {
portion *= 5/3;
}
return portion;
};
var prevBound = min;
// now go through and do everything // now go through and do everything
// TODO: order so the max width children are in the middle!! // TODO: order so the max width children are in the middle!!
_.each(children, function(child) { _.each(children, function(child, index) {
if (!child.isMainParent(commit)) { if (!child.isMainParent(commit)) {
return; return;
} }
var flex = child.get('visNode').getMaxWidthScaled(); var flex = child.get('visNode').getMaxWidthScaled();
var portion = (flex / totalFlex) * myLength; var portion = (flex / totalFlex) * myLength;
var adjustedPortion = checkPortion(portion, index);
var childMin = prevBound; var childMin = prevBound;
var childMax = childMin + portion; var childMax = childMin + adjustedPortion;
this.assignBoundsRecursive(child, childMin, childMax); this.assignBoundsRecursive(child, childMin, childMax);
prevBound = childMax; prevBound = childMin + portion;
}, this); }, this);
}; };
@ -19733,6 +19749,8 @@ require.define("/src/js/dialogs/sandbox.js",function(require,module,exports,__di
'', '',
'Have a great lesson to share? Try building a level with `build level` or try out a friend\'s level with `import level`', 'Have a great lesson to share? Try building a level with `build level` or try out a friend\'s level with `import level`',
'', '',
'To see the full range of commands, try `show commands`. There are some gems like `undo` and `reset`',
'',
'For now let\'s get you started on the `levels`...' 'For now let\'s get you started on the `levels`...'
] ]
} }
@ -20350,6 +20368,8 @@ require.define("/src/js/dialogs/sandbox.js",function(require,module,exports,__di
'', '',
'Have a great lesson to share? Try building a level with `build level` or try out a friend\'s level with `import level`', 'Have a great lesson to share? Try building a level with `build level` or try out a friend\'s level with `import level`',
'', '',
'To see the full range of commands, try `show commands`. There are some gems like `undo` and `reset`',
'',
'For now let\'s get you started on the `levels`...' 'For now let\'s get you started on the `levels`...'
] ]
} }
@ -29239,21 +29259,37 @@ GitVisuals.prototype.assignBoundsRecursive = function(commit, min, max) {
} }
}, this); }, this);
var prevBound = min; var checkPortion = function(portion, index) {
if (myLength < 0.99 || children.length < 2) {
return portion;
}
// we introduce a VERY specific rule here, to push out
// the first "divergence" of the graph
if (index === 0) {
portion *= 1/3;
} else if (index === children.length - 1) {
portion *= 5/3;
}
return portion;
};
var prevBound = min;
// now go through and do everything // now go through and do everything
// TODO: order so the max width children are in the middle!! // TODO: order so the max width children are in the middle!!
_.each(children, function(child) { _.each(children, function(child, index) {
if (!child.isMainParent(commit)) { if (!child.isMainParent(commit)) {
return; return;
} }
var flex = child.get('visNode').getMaxWidthScaled(); var flex = child.get('visNode').getMaxWidthScaled();
var portion = (flex / totalFlex) * myLength; var portion = (flex / totalFlex) * myLength;
var adjustedPortion = checkPortion(portion, index);
var childMin = prevBound; var childMin = prevBound;
var childMax = childMin + portion; var childMax = childMin + adjustedPortion;
this.assignBoundsRecursive(child, childMin, childMax); this.assignBoundsRecursive(child, childMin, childMax);
prevBound = childMax; prevBound = childMin + portion;
}, this); }, this);
}; };

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

2
build/bundle.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -412,7 +412,7 @@
For a much easier time perusing the source, see the individual files at: For a much easier time perusing the source, see the individual files at:
https://github.com/pcottle/learnGitBranching https://github.com/pcottle/learnGitBranching
--> -->
<script src="build/bundle.min.35e609a6.js"></script> <script src="build/bundle.min.6a082b7e.js"></script>
<!-- The advantage of github pages: super-easy, simple, slick static hostic. <!-- 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 The downside? No raw logs to parse for analytics, so I have to include

View file

@ -49,6 +49,8 @@ exports.dialog = {
'', '',
'Have a great lesson to share? Try building a level with `build level` or try out a friend\'s level with `import level`', 'Have a great lesson to share? Try building a level with `build level` or try out a friend\'s level with `import level`',
'', '',
'To see the full range of commands, try `show commands`. There are some gems like `undo` and `reset`',
'',
'For now let\'s get you started on the `levels`...' 'For now let\'s get you started on the `levels`...'
] ]
} }

View file

@ -516,21 +516,37 @@ GitVisuals.prototype.assignBoundsRecursive = function(commit, min, max) {
} }
}, this); }, this);
var prevBound = min; var checkPortion = function(portion, index) {
if (myLength < 0.99 || children.length < 2) {
return portion;
}
// we introduce a VERY specific rule here, to push out
// the first "divergence" of the graph
if (index === 0) {
portion *= 1/3;
} else if (index === children.length - 1) {
portion *= 5/3;
}
return portion;
};
var prevBound = min;
// now go through and do everything // now go through and do everything
// TODO: order so the max width children are in the middle!! // TODO: order so the max width children are in the middle!!
_.each(children, function(child) { _.each(children, function(child, index) {
if (!child.isMainParent(commit)) { if (!child.isMainParent(commit)) {
return; return;
} }
var flex = child.get('visNode').getMaxWidthScaled(); var flex = child.get('visNode').getMaxWidthScaled();
var portion = (flex / totalFlex) * myLength; var portion = (flex / totalFlex) * myLength;
var adjustedPortion = checkPortion(portion, index);
var childMin = prevBound; var childMin = prevBound;
var childMax = childMin + portion; var childMax = childMin + adjustedPortion;
this.assignBoundsRecursive(child, childMin, childMax); this.assignBoundsRecursive(child, childMin, childMax);
prevBound = childMax; prevBound = childMin + portion;
}, this); }, this);
}; };