Update BranchProfile Coloring
This commit is contained in:
Родитель
f46cf8df77
Коммит
ab2266d2bf
|
@ -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);
|
||||
|
|
Загрузка…
Ссылка в новой задаче