mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-18 06:49:47 +02:00
GitGraph: simplified branch check in arrow rerouting fn
Wanted to avoid repetition given that the originally nested ternaries had the same structure
This commit is contained in:
@@ -359,14 +359,9 @@ const drawCommits = (svg, commits, modifyGraph) => {
|
||||
* return true
|
||||
*/
|
||||
const shouldRerouteArrow = (commitA, commitB, p1, p2, allCommits) => {
|
||||
const branchToGetCurve =
|
||||
dir === 'TB'
|
||||
? p1.x < p2.x
|
||||
? commitB.branch
|
||||
: commitA.branch
|
||||
: p1.y < p2.y
|
||||
? commitB.branch
|
||||
: commitA.branch;
|
||||
const branchToGetCurve = (dir === 'TB' ? p1.x < p2.x : p1.y < p2.y)
|
||||
? 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) => {
|
||||
|
Reference in New Issue
Block a user