mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-26 10:49:38 +02: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:
@@ -359,9 +359,8 @@ const drawCommits = (svg, commits, modifyGraph) => {
|
|||||||
* return true
|
* return true
|
||||||
*/
|
*/
|
||||||
const shouldRerouteArrow = (commitA, commitB, p1, p2, allCommits) => {
|
const shouldRerouteArrow = (commitA, commitB, p1, p2, allCommits) => {
|
||||||
const branchToGetCurve = (dir === 'TB' ? p1.x < p2.x : p1.y < p2.y)
|
const commitBIsFurthest = dir === 'TB' ? p1.x < p2.x : p1.y < p2.y;
|
||||||
? commitB.branch
|
const branchToGetCurve = commitBIsFurthest ? commitB.branch : commitA.branch;
|
||||||
: commitA.branch;
|
|
||||||
const isOnBranchToGetCurve = (x) => x.branch === branchToGetCurve;
|
const isOnBranchToGetCurve = (x) => x.branch === branchToGetCurve;
|
||||||
const isBetweenCommits = (x) => x.seq > commitA.seq && x.seq < commitB.seq;
|
const isBetweenCommits = (x) => x.seq > commitA.seq && x.seq < commitB.seq;
|
||||||
return Object.values(allCommits).some((commitX) => {
|
return Object.values(allCommits).some((commitX) => {
|
||||||
|
Reference in New Issue
Block a user