This commit is contained in:
darthtrevino 2016-07-07 14:37:32 -07:00
Родитель f46cf8df77
Коммит ab2266d2bf
4 изменённых файлов: 25 добавлений и 10 удалений

Просмотреть файл

@ -6,5 +6,4 @@ gulpfile.babel.js
.eslintrc
.babelrc
server.js
.npmignore
*~
.npmignore

Просмотреть файл

@ -42,7 +42,7 @@ gulp.task('babel', () => (
));
gulp.task('watch', ['default'], () => {
gulp.watch(paths.js, ['lint:js', 'babel']).on('error', gutil.log);
gulp.watch(paths.js, ['lint:js', 'babel']);
gulp.watch(paths.sass, ['lint:sass', 'sass', 'copy:sass']).on('error', gutil.log);
});

Просмотреть файл

@ -11,6 +11,12 @@
},
"author": "Chris Trevino <chris.trevino@atsid.com>",
"license": "ISC",
"files": [
"package.json",
"README.md",
"LICENSE",
"lib/"
],
"devDependencies": {
"babel-core": "^6.7.2",
"babel-loader": "^6.2.4",

Просмотреть файл

@ -30,15 +30,25 @@ function infoSpanStyle(backgroundColor, flex) {
function activeInfoSpans(start, end, currentBranchStart, currentBranchEnd, type, activeStateIndex) {
let result;
if (!activeStateIndex && activeStateIndex !== 0) {
const isActiveStatePresent = !activeStateIndex && activeStateIndex !== 0;
if (isActiveStatePresent) {
// Case 1 No activeStateIndex
const ancestorLength = (currentBranchEnd || end) - (currentBranchStart || start) + 1;
const totalLength = end - start + 1;
const unrelatedLength = totalLength - ancestorLength;
result = [
infoSpanStyle(branchColor(type, 'pre'), ancestorLength),
infoSpanStyle(branchColor(type, 'post'), unrelatedLength),
];
const isCurrentBranchInProfile = currentBranchEnd !== null && currentBranchEnd !== undefined;
// 1.1 - Split the track into ancestral/unrelated blocks
if (isCurrentBranchInProfile) {
const ancestorLength = (currentBranchEnd || end) - (currentBranchStart || start) + 1;
const unrelatedLength = totalLength - ancestorLength;
result = [
infoSpanStyle(branchColor(type, 'pre'), ancestorLength),
infoSpanStyle(branchColor(type, 'post'), unrelatedLength),
];
} else {
// 1.2 - Entire block is unrelated
result = [infoSpanStyle(branchColor(type, 'post'), totalLength)];
}
} else {
const afterActiveLength = end - activeStateIndex;
const unrelatedLength = end - (currentBranchEnd || activeStateIndex);