mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-18 23:09:49 +02:00
Work in progress
This commit is contained in:
21
src/diagrams/git/layout.js
Normal file
21
src/diagrams/git/layout.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import { getConfig } from '../../config';
|
||||
|
||||
export default (dir, _branches, _commits) => { // eslint-disable-line
|
||||
const config = getConfig().gitGraph;
|
||||
const branches = [];
|
||||
const commits = [];
|
||||
|
||||
for (let i = 0; i < _branches.length; i++) {
|
||||
const branch = Object.assign({}, _branches[i]);
|
||||
if (dir === 'TB' || dir === 'BT') {
|
||||
branch.x = config.branchOffset * i;
|
||||
branch.y = -1;
|
||||
} else {
|
||||
branch.y = config.branchOffset * i;
|
||||
branch.x = -1;
|
||||
}
|
||||
branches.push(branch);
|
||||
}
|
||||
|
||||
return { branches, commits };
|
||||
};
|
Reference in New Issue
Block a user