mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-01-14 06:43:25 +08:00
GitGraph: made reroute fn more readable
Pre-commit lint hook had made the use of ternaries harder to read than I'd originally intended so I introduced an additional variable which explains what is being checked and keeps ternaries from becoming obscured.
This commit is contained in:
parent
a9c5d903c5
commit
57a9d7356c
@ -359,9 +359,8 @@ const drawCommits = (svg, commits, modifyGraph) => {
|
||||
* return true
|
||||
*/
|
||||
const shouldRerouteArrow = (commitA, commitB, p1, p2, allCommits) => {
|
||||
const branchToGetCurve = (dir === 'TB' ? p1.x < p2.x : p1.y < p2.y)
|
||||
? commitB.branch
|
||||
: commitA.branch;
|
||||
const commitBIsFurthest = dir === 'TB' ? p1.x < p2.x : p1.y < p2.y;
|
||||
const branchToGetCurve = commitBIsFurthest ? commitB.branch : commitA.branch;
|
||||
const isOnBranchToGetCurve = (x) => x.branch === branchToGetCurve;
|
||||
const isBetweenCommits = (x) => x.seq > commitA.seq && x.seq < commitB.seq;
|
||||
return Object.values(allCommits).some((commitX) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user